CSC UNIX System, Spring 2015

Size: px
Start display at page:

Download "CSC UNIX System, Spring 2015"

Transcription

1 CSC UNIX System, Spring 2015 Study guide for the CSC352 midterm exam (20% of grade). Dr. Dale E. Parson, We will have a midterm on March 19 on material we have covered through spring break except for any Shell programming we might start on March 5. The purpose of this study guide is to limit the amount of material that you need to try to memorize. The UNIX commands and related system information go both deep and wide. We need to limit the scope of an exam. Major topics appear by number below. 1. Files, directories, and related commands. Know about the various types of files: regular files, directories, symbolic links, named pipes, character I/O devices (such as a terminal that reads or writes one character at a time) and block I/O devices (such as a disk that can transfer a block of data at a time). Below are some examples from running ls ld on respective files of those types. The first field in each line shows the type of file referenced by that directory entry. -rw-r--r-- 1 parson faculty 93 Mar bignum.py (regular file) drwxr-xr-x 6 parson faculty 512 Feb 20 19:12 unix (directory) lrwxrwxrwx 1 parson faculty 52 Jan 9 19:40 threadwait -> /export/home/faculty/parson/multip/csc580/threadwait (a symbolic link) prw-r--r-- 1 parson faculty 0 Feb 7 17:08 mypipe (named pipe created via mknod) crw--w parson tty 24, 1 Feb 21 10:42 /devices/pseudo/pts@0:1 (character I/O, this is a terminal) brw-r root sys 32, 16 Feb 21 10:44 /devices/pci@0/pci@0/pci@1/pci@0/pci@1/pci@0/usb@0,2/storage@2/disk@0,0:a (block I/O, here a disk) Know about the ls command and its options for inspecting the contents of a directory. Here are the options to know. You can combine multiple options together, such as ls alrtr. -l (create a long listing the option letter is ell the above listings are long listing) -a (show all entries including the ones whose names begin with a period) -t (sort the output according to modification time, most recent at the top) -r (reverse the direction of the sort; ls lrt places the oldest at the top) -i (print the inode number every file has an inode number, and multiple hard links may refer to the same, single inode number. The inode number is the actual file ID.) -R (apply this ls command and its options recursively to every subdirectory below) -d (list a directory entry without showing that directories contents. This option shows the directory s entry in its parent, rather than showing what is in that directory.) If you give ls a command line of file names, it will list those. If you give it files names with wildcards such as * without quoting those wildcards, the shell will expand the wildcards before running ls. If any of those names is a directory, it will show the contents of that directory unless you use the d option. You can give absolute paths to ls or any command requiring a file name; and absolute path starts at /, which is the root directory. You can give a relative path as well; a relative path does not have a leading /, and it starts in the current directory. CSC 352, UNIX midterm preparation, page 1 of 6, Spring 2015

2 The file command shows you what kind of contents are in files. This command looks into the files. Here are some outputs for the file command from the above listed files and some others. -bash-3.00$ file bignum.py bignum.py: ascii text -bash-3.00$ file unix unix: directory -bash-3.00$ file threadwait threadwait: directory (It follows the symbolic link to its target directory or file.) -bash-3.00$ file mypipe mypipe: fifo (A first-in-first-out FIFO is another name for a pipe.) -bash-3.00$ file /devices/pseudo/pts@0:1 /devices/pseudo/pts@0:1: character special (24/1) -bash-3.00$ file /devices/pci@0/pci@0/pci@1/pci@0/pci@1/pci@0/usb@0,2/storage@2/disk@0,0:a /devices/pci@0/pci@0/pci@1/pci@0/pci@1/pci@0/usb@0,2/storage@2/disk@0,0:a: block special (32/16) -bash-3.00$ file TwoDimensionalBoardGame.java TwoDimensionalBoardGame.java: ascii text -bash-3.00$ file TwoDimensionalBoardGame.class TwoDimensionalBoardGame.class: java class file -bash-3.00$ file seeargs.c seeargs.o seeargs seeargs.c: c program text seeargs.o: ELF 32-bit MSB relocatable SPARC Version 1 seeargs: ELF 32-bit MSB executable SPARC Version 1, dynamically linked, not stripped Note that the java class file and the ELF SPARC files above hold executable binary data for compiled Java and C programs respectively. The grep command is good for searching through textual files. We will get to regular expression wildcard patterns later this semester. Here is what you need to know for now. grep STRING FILENAMES grep -i STRING FILENAMES grep STRING -bash-3.00$ ls grep make makefile makejar makelib (Search for STRING in one or more files.) (A case-insensitive version search STRING in upper or lower case.) (Without file names it searches lines in stdin for the STRING.) Example of this last one: Here are some other commands relating to files that you should know about. cat more less wc Concatenate one or more files and send their contents to standard out. Scroll the contents of a file to the terminal. Scroll the contents of a file to the terminal. Count lines, words and characters in a file. Example: CSC 352, UNIX midterm preparation, page 2 of 6, Spring 2015

3 -bash-3.00$ wc seeargs.c seeargs.c find Search a directory given as the first argument for files matching the qualifiers. Qualifiers to know: -type for the file type, such as type d for directories, -type f for regular files. -name for a name, such as name S*.java for all Java source files starting in S. Make sure to quote any name that has a pattern, so the shell does not expand the pattern in the current directory. -mtime for modification time, such as mtime -30 for any file modified in the last 30 days, or mtime +30 for any file with modification older than 30 days ago. zip bundle files into a ZIP archive. zip r recursively includes subdirectory contents. unzip Unzip a ZIP archive created with zip. Examples: zip r seeargs.zip seeargs creates archive seeargs.zip from contents of directory seeargs. unzip seeargs.zip extracts directories and file from above archive. tar Create a so-called tape archive file in a UNIX format. It is not compressed. This command can also extract the files from a tar archive file. gzip GNU zip, a predecessor to zip that can compress an existing file such as a tar archive. zcat,gzcat,gunzip Variants of the extractor for GNU gzip files. emacs vi diff Editor for textual files. Editor for textual files. Compare two textual files for differences. 2. Shell commands, variables, and processes File redirection operators include the following. I have put them in quotes so that MS Word does not alter them. > FILE Sends stdout to the named FILE, either creating or truncating the FILE. >> FILE Sends stdout to the named FILE, either creating or appending the FILE. 2> FILE Sends stderr to the named FILE, either creating or truncating the FILE. 2> &1 Sends stderr to the same destination as stdout. < FILE Reads stdin from the named FILE. command1 commands2 Pipes the stdout of command1 to the stdin of command2. Shell variables. MYVAR=STRING set MYVAR STRING export MYVAR export MYVAR=STRING I will use bash on the exam. Sets the value of MYVAR to STRING in all shells except C-shell. Sets the value of MYVAR to STRING in C-shell. Make MYVAR a global variable visible to processes created by this shell. Same as last line, this form also sets the value on the same line. CSC 352, UNIX midterm preparation, page 3 of 6, Spring 2015

4 setenv MYVAR STRING echo $MYVAR This is how C-shell exports a global variable. Echo the shell variable to stdout. Use a $ to get the value of a shell variable. Important shell variables: SHELL HOME CDPATH Path to the shell program started by some programs such as script. Path to your login directory. Colon-separated list of directory paths where the shell searches when you use the cd command. PATH Colon-separated list of directory paths where the shell searches for the command Files such as ls that you enter into the shell. Example: -bash-3.00$ echo $PATH /usr/jdk/jdk1.6.0_02/bin/:/opt/csw/bin:/usr/sbin:/opt/csw/graphviz2/bin:/usr/local/smlnj/bin:/bin:/usr/bin:/usr/local/bi n:/usr/ccs/bin:/opt/csw/gcc3/bin:/opt/csw/mysql5/bin:/usr/sfw/bin:/opt/csw/bin:/opt/sunwspro/bin:/usr/jdk/jdk1.6.0 _02/bin:/usr/local/instantclient_10_2 -bash-3.00$ which ls /usr/bin/ls /usr/bin is a component of my $PATH. -bash-3.00$ which kjerhbjke no kjerhbjke in /usr/jdk/jdk1.6.0_02/bin/ /opt/csw/bin /usr/sbin /opt/csw/graphviz2/bin /usr/local/smlnj/bin /bin /usr/bin /usr/local/bin /usr/ccs/bin /opt/csw/gcc3/bin /opt/csw/mysql5/bin /usr/sfw/bin /opt/csw/bin /opt/sunwspro/bin /usr/jdk/jdk1.6.0_02/bin /usr/local/instantclient_10_2 Command line substitution of wildcard characters by the shell occurs before the shell invokes your program. The * (asterisk) substitutes for zero or more characters in the specified directory, and the [abc] pattern matches any one of those characters in the square braces. Example: -bash-3.00$ ls -d $HOME/[Uu]*[xX]* /export/home/faculty/parson/unix /export/home/faculty/parson/unixsysprog Back-quotes, also known as back-ticks, run the command enclosed in the back-quotes, and then substitute whatever that command writes to its stdout, back into the command line containing the back-quotes. For example: -bash-3.00$ cd ~/unix -bash-3.00$ echo `pwd` /export/home/faculty/parson/unix # Substitute stdout from `pwd` back into echo s command line Double quotes allow you to enclose spaces and tabs within a single command line arguments or other string value within the shell. Double quotes inhibit wildcards for file name characters, but double quotes allow shell substitution for $VARIABLES and back-quotes. Here are some examples. -bash-3.00$ ls -d *t runcat -bash-3.00$ ls -d "*t" *t: No such file or directory -bash-3.00$ ls -d $HOME /export/home/faculty/parson CSC 352, UNIX midterm preparation, page 4 of 6, Spring 2015

5 -bash-3.00$ ls -d "$HOME" /export/home/faculty/parson -bash-3.00$ ls -d "`pwd`" /export/home/faculty/parson/unix -bash-3.00$ echo hello > "three word file" -bash-3.00$ ls -l "three word file" -rw-r--r-- 1 parson faculty 6 Feb 21 20:25 three word file -bash-3.00$ cat "three word file" hello A \ backslash can escape shell special treatment of any single character, such as a space or *. -bash-3.00$ cat three\ word\ file hello -bash-3.00$ echo \$HOME $HOME -bash-3.00$ echo \* * -bash-3.00$ echo \`pwd\` `pwd` Single quotes inhibit wildcards, $VARIABLES and back-quotes from expansion by the shell. Compare the following examples with the double quoted examples above. -bash-3.00$ ls -d *t runcat -bash-3.00$ ls -d '*t' *t: No such file or directory -bash-3.00$ ls -d '$HOME' $HOME: No such file or directory -bash-3.00$ ls -d '`pwd`' `pwd`: No such file or directory GNU make uses a makefile to interpret rules contained in that makefile. Each rule consists of: Target: Dependency Action Where the Target is mandatory, and one or Dependencies (on the same line as the Target) and Actions (on separate lines) are optional. Each Target defines a goal to be accomplished. It may be a target file that needs to be compiled. Each Dependency (if any) is something that the Target depends on. A Dependency may be a source file on which a Target file depends for compilation. A Dependency may also be a Target in another rule; that rule must be executed as part of Dependency checking of the above rule. The Actions are invocation lines passed to the shell, for example to compile files or to remove files. 3. UNIX processes CSC 352, UNIX midterm preparation, page 5 of 6, Spring 2015

6 When you invoke a program from the shell, the shell requests that the underlying UNIX system A) loads that machine-code program from disk into memory, and then B) runs that program in memory using CPU resources such as registers and arithmetic units. A process is a running program. See the computer diagram from week 1. Many processes spend most of their lifetime in the sleep state, waiting for input (from a terminal, disk drive or network interface device), or waiting for output operations (to a monitor, disk drive or network interface device) to complete. Bill has two CPUs, so only two processes can actually be running at a time. (Harry has 64, Hermione has 16, and Ron has 32.) When a process is asleep, UNIX may page portions of its memory contents to disk, or it may swap the entire snapshot of memory to disk. When the input or output operation that the process was awaiting is completed, UNIX can page or swap the memory images from disk back to memory, then resume running the process until it is ready to sleep again. For processes that do a lot of computation with little I/O so-called CPU-bound processes UNIX interrupts these processes periodically, forcing them to sleep for a while to free up CPU for other processes. -bash-3.00$ ps f # Note the user ID, the process ID, its parent process ID, and its command UID PID PPID C STIME TTY TIME CMD parson :00:13 pts/33 0:00 -bash parson :55:41 pts/33 0:00 ps f -bash-3.00$ ps f -p 0 # Process ID 0 schedules process to run on the CPU. UID PID PPID C STIME TTY TIME CMD root Jul 25? 0:12 sched -bash-3.00$ ps f -p 1 # Process ID 1, init, starts other major UNIX processes and cleans up processes. UID PID PPID C STIME TTY TIME CMD root Jul 25? 21:36 /sbin/init CSC 352, UNIX midterm preparation, page 6 of 6, Spring 2015

Operating Systems, Unix Files and Commands SEEM

Operating Systems, Unix Files and Commands SEEM Operating Systems, Unix Files and Commands SEEM 3460 1 Major Components of Operating Systems (OS) Process management Resource management CPU Memory Device File system Bootstrapping SEEM 3460 2 Programs

More information

5/20/2007. Touring Essential Programs

5/20/2007. Touring Essential Programs Touring Essential Programs Employing fundamental utilities. Managing input and output. Using special characters in the command-line. Managing user environment. Surveying elements of a functioning system.

More information

Appendix A GLOSSARY. SYS-ED/ Computer Education Techniques, Inc.

Appendix A GLOSSARY. SYS-ED/ Computer Education Techniques, Inc. Appendix A GLOSSARY SYS-ED/ Computer Education Techniques, Inc. $# Number of arguments passed to a script. $@ Holds the arguments; unlike $* it has the capability for separating the arguments. $* Holds

More information

Unix Processes. What is a Process?

Unix Processes. What is a Process? Unix Processes Process -- program in execution shell spawns a process for each command and terminates it when the command completes Many processes all multiplexed to a single processor (or a small number

More information

Review of Fundamentals

Review of Fundamentals Review of Fundamentals 1 The shell vi General shell review 2 http://teaching.idallen.com/cst8207/14f/notes/120_shell_basics.html The shell is a program that is executed for us automatically when we log

More information

Read the relevant material in Sobell! If you want to follow along with the examples that follow, and you do, open a Linux terminal.

Read the relevant material in Sobell! If you want to follow along with the examples that follow, and you do, open a Linux terminal. Warnings 1 First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion. Read the relevant material in Sobell! If

More information

Unix/Linux Basics. Cpt S 223, Fall 2007 Copyright: Washington State University

Unix/Linux Basics. Cpt S 223, Fall 2007 Copyright: Washington State University Unix/Linux Basics 1 Some basics to remember Everything is case sensitive Eg., you can have two different files of the same name but different case in the same folder Console-driven (same as terminal )

More information

Table of contents. Our goal. Notes. Notes. Notes. Summer June 29, Our goal is to see how we can use Unix as a tool for developing programs

Table of contents. Our goal. Notes. Notes. Notes. Summer June 29, Our goal is to see how we can use Unix as a tool for developing programs Summer 2010 Department of Computer Science and Engineering York University Toronto June 29, 2010 1 / 36 Table of contents 1 2 3 4 2 / 36 Our goal Our goal is to see how we can use Unix as a tool for developing

More information

Files

Files http://www.cs.fsu.edu/~langley/cop3353-2013-1/reveal.js-2013-02-11/02.html?print-pdf 02/11/2013 10:55 AM Files A normal "flat" file is a collection of information. It's usually stored somewhere reasonably

More information

Introduction to Linux

Introduction to Linux Introduction to Linux Mukesh Pund Principal Scientist, NISCAIR, New Delhi, India History In 1969, a team of developers developed a new operating system called Unix which was written using C Linus Torvalds,

More information

Introduction: What is Unix?

Introduction: What is Unix? Introduction Introduction: What is Unix? An operating system Developed at AT&T Bell Labs in the 1960 s Command Line Interpreter GUIs (Window systems) are now available Introduction: Unix vs. Linux Unix

More information

Introduction to Linux Organizing Files

Introduction to Linux Organizing Files Introduction to Linux Organizing Files Computational Science and Engineering North Carolina A&T State University Instructor: Dr. K. M. Flurchick Email: kmflurch@ncat.edu Arranging, Organizing, Packing

More information

First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion.

First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion. Warnings 1 First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion. Read the relevant material in Sobell! If

More information

Basics. I think that the later is better.

Basics.  I think that the later is better. Basics Before we take up shell scripting, let s review some of the basic features and syntax of the shell, specifically the major shells in the sh lineage. Command Editing If you like vi, put your shell

More information

Introduction to Linux

Introduction to Linux Introduction to Linux January 2011 Don Bahls User Consultant (Group Leader) bahls@arsc.edu (907) 450-8674 Overview The shell Common Commands File System Organization Permissions Environment Variables I/O

More information

CS 307: UNIX PROGRAMMING ENVIRONMENT FIND COMMAND

CS 307: UNIX PROGRAMMING ENVIRONMENT FIND COMMAND CS 307: UNIX PROGRAMMING ENVIRONMENT FIND COMMAND Prof. Michael J. Reale Fall 2014 Finding Files in a Directory Tree Suppose you want to find a file with a certain filename (or with a filename matching

More information

Introduction to UNIX. Introduction EECS l UNIX is an operating system (OS). l Our goals:

Introduction to UNIX. Introduction EECS l UNIX is an operating system (OS). l Our goals: Introduction to UNIX EECS 2031 13 November 2017 Introduction l UNIX is an operating system (OS). l Our goals: Learn how to use UNIX OS. Use UNIX tools for developing programs/ software, specifically shell

More information

Review of Fundamentals. Todd Kelley CST8207 Todd Kelley 1

Review of Fundamentals. Todd Kelley CST8207 Todd Kelley 1 Review of Fundamentals Todd Kelley kelleyt@algonquincollege.com CST8207 Todd Kelley 1 GPL the shell SSH (secure shell) the Course Linux Server RTFM vi general shell review 2 These notes are available on

More information

Week 5 Lesson 5 02/28/18

Week 5 Lesson 5 02/28/18 Week 5 Lesson 5 02/28/18 Important Announcements Extra Credits If you haven t done so, send your pictures to risimms@cabrillo.edu for 3 points EXTRA CREDIT. Join LinkedIn for 3 points Perkins/VTEA Survey

More information

Introduction to UNIX Shell Exercises

Introduction to UNIX Shell Exercises Introduction to UNIX Shell Exercises Determining Your Shell Open a new window or use an existing window for this exercise. Observe your shell prompt - is it a $ or %? What does this tell you? Find out

More information

A shell can be used in one of two ways:

A shell can be used in one of two ways: Shell Scripting 1 A shell can be used in one of two ways: A command interpreter, used interactively A programming language, to write shell scripts (your own custom commands) 2 If we have a set of commands

More information

Files and Directories

Files and Directories CSCI 2132: Software Development Files and Directories Norbert Zeh Faculty of Computer Science Dalhousie University Winter 2019 Files and Directories Much of the operation of Unix and programs running on

More information

UNIX and Linux Essentials Student Guide

UNIX and Linux Essentials Student Guide UNIX and Linux Essentials Student Guide D76989GC10 Edition 1.0 June 2012 D77816 Authors Uma Sannasi Pardeep Sharma Technical Contributor and Reviewer Harald van Breederode Editors Anwesha Ray Raj Kumar

More information

Introduction to the shell Part II

Introduction to the shell Part II Introduction to the shell Part II Graham Markall http://www.doc.ic.ac.uk/~grm08 grm08@doc.ic.ac.uk Civil Engineering Tech Talks 16 th November, 1pm Last week Covered applications and Windows compatibility

More information

Linux shell programming for Raspberry Pi Users - 2

Linux shell programming for Raspberry Pi Users - 2 Linux shell programming for Raspberry Pi Users - 2 Sarwan Singh Assistant Director(S) NIELIT Chandigarh 1 SarwanSingh.com Education is the kindling of a flame, not the filling of a vessel. - Socrates SHELL

More information

Chapter-3. Introduction to Unix: Fundamental Commands

Chapter-3. Introduction to Unix: Fundamental Commands Chapter-3 Introduction to Unix: Fundamental Commands What You Will Learn The fundamental commands of the Unix operating system. Everything told for Unix here is applicable to the Linux operating system

More information

Lecture # 2 Introduction to UNIX (Part 2)

Lecture # 2 Introduction to UNIX (Part 2) CS390 UNIX Programming Spring 2009 Page 1 Lecture # 2 Introduction to UNIX (Part 2) UNIX is case sensitive (lowercase, lowercase, lowercase) Logging in (Terminal Method) Two basic techniques: 1. Network

More information

Utilities. September 8, 2015

Utilities. September 8, 2015 Utilities September 8, 2015 Useful ideas Listing files and display text and binary files Copy, move, and remove files Search, sort, print, compare files Using pipes Compression and archiving Your fellow

More information

UNIX Essentials Featuring Solaris 10 Op System

UNIX Essentials Featuring Solaris 10 Op System A Active Window... 7:11 Application Development Tools... 7:7 Application Manager... 7:4 Architectures - Supported - UNIX... 1:13 Arithmetic Expansion... 9:10 B Background Processing... 3:14 Background

More information

CMU MSP 36602: Intro to UNIX and Scripting: Part 1

CMU MSP 36602: Intro to UNIX and Scripting: Part 1 CMU MSP 36602: Intro to UNIX and Scripting: Part 1 H. Seltman March 28, 2018 I. Overview a. UNIX is an operating system which is a competitor to and partial ancestor of MS-DOS, MS-Windows, and Mac OSX.

More information

CSC209H Lecture 1. Dan Zingaro. January 7, 2015

CSC209H Lecture 1. Dan Zingaro. January 7, 2015 CSC209H Lecture 1 Dan Zingaro January 7, 2015 Welcome! Welcome to CSC209 Comments or questions during class? Let me know! Topics: shell and Unix, pipes and filters, C programming, processes, system calls,

More information

DATA 301 Introduction to Data Analytics Command Line. Dr. Ramon Lawrence University of British Columbia Okanagan

DATA 301 Introduction to Data Analytics Command Line. Dr. Ramon Lawrence University of British Columbia Okanagan DATA 301 Introduction to Data Analytics Command Line Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Why learn the Command Line? The command line is the text interface

More information

Why learn the Command Line? The command line is the text interface to the computer. DATA 301 Introduction to Data Analytics Command Line

Why learn the Command Line? The command line is the text interface to the computer. DATA 301 Introduction to Data Analytics Command Line DATA 301 Introduction to Data Analytics Command Line Why learn the Command Line? The command line is the text interface to the computer. DATA 301: Data Analytics (2) Understanding the command line allows

More information

Linux Training. for New Users of Cluster. Georgia Advanced Computing Resource Center University of Georgia Suchitra Pakala

Linux Training. for New Users of Cluster. Georgia Advanced Computing Resource Center University of Georgia Suchitra Pakala Linux Training for New Users of Cluster Georgia Advanced Computing Resource Center University of Georgia Suchitra Pakala pakala@uga.edu 1 Overview GACRC Linux Operating System Shell, Filesystem, and Common

More information

Review of Fundamentals. Todd Kelley CST8207 Todd Kelley 1

Review of Fundamentals. Todd Kelley CST8207 Todd Kelley 1 Review of Fundamentals Todd Kelley kelleyt@algonquincollege.com CST8207 Todd Kelley 1 The CST8207 course notes GPL the shell SSH (secure shell) the Course Linux Server RTFM vi general shell review 2 Linux

More information

Part III. Shell Config. Tobias Neckel: Scripting with Bash and Python Compact Max-Planck, February 16-26,

Part III. Shell Config. Tobias Neckel: Scripting with Bash and Python Compact Max-Planck, February 16-26, Part III Shell Config Compact Course @ Max-Planck, February 16-26, 2015 33 Special Directories. current directory.. parent directory ~ own home directory ~user home directory of user ~- previous directory

More information

Introduction to Linux. Roman Cheplyaka

Introduction to Linux. Roman Cheplyaka Introduction to Linux Roman Cheplyaka Generic commands, files, directories What am I running? ngsuser@ubuntu:~$ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=16.04 DISTRIB_CODENAME=xenial DISTRIB_DESCRIPTION="Ubuntu

More information

UNIX System Programming Lecture 3: BASH Programming

UNIX System Programming Lecture 3: BASH Programming UNIX System Programming Outline Filesystems Redirection Shell Programming Reference BLP: Chapter 2 BFAQ: Bash FAQ BMAN: Bash man page BPRI: Bash Programming Introduction BABS: Advanced Bash Scripting Guide

More information

Linux Command Line Interface. December 27, 2017

Linux Command Line Interface. December 27, 2017 Linux Command Line Interface December 27, 2017 Foreword It is supposed to be a refresher (?!) If you are familiar with UNIX/Linux/MacOS X CLI, this is going to be boring... I will not talk about editors

More information

Lab 2: Linux/Unix shell

Lab 2: Linux/Unix shell Lab 2: Linux/Unix shell Comp Sci 1585 Data Structures Lab: Tools for Computer Scientists Outline 1 2 3 4 5 6 7 What is a shell? What is a shell? login is a program that logs users in to a computer. When

More information

Useful Unix Commands Cheat Sheet

Useful Unix Commands Cheat Sheet Useful Unix Commands Cheat Sheet The Chinese University of Hong Kong SIGSC Training (Fall 2016) FILE AND DIRECTORY pwd Return path to current directory. ls List directories and files here. ls dir List

More information

CSE 15L Winter Midterm :) Review

CSE 15L Winter Midterm :) Review CSE 15L Winter 2015 Midterm :) Review Makefiles Makefiles - The Overview Questions you should be able to answer What is the point of a Makefile Why don t we just compile it again? Why don t we just use

More information

CSC209. Software Tools and Systems Programming. https://mcs.utm.utoronto.ca/~209

CSC209. Software Tools and Systems Programming. https://mcs.utm.utoronto.ca/~209 CSC209 Software Tools and Systems Programming https://mcs.utm.utoronto.ca/~209 What is this Course About? Software Tools Using them Building them Systems Programming Quirks of C The file system System

More information

Shell Scripting. Todd Kelley CST8207 Todd Kelley 1

Shell Scripting. Todd Kelley CST8207 Todd Kelley 1 Shell Scripting Todd Kelley kelleyt@algonquincollege.com CST8207 Todd Kelley 1 If we have a set of commands that we want to run on a regular basis, we could write a script A script acts as a Linux command,

More information

CSCI 2132 Software Development. Lecture 4: Files and Directories

CSCI 2132 Software Development. Lecture 4: Files and Directories CSCI 2132 Software Development Lecture 4: Files and Directories Instructor: Vlado Keselj Faculty of Computer Science Dalhousie University 12-Sep-2018 (4) CSCI 2132 1 Previous Lecture Some hardware concepts

More information

Introduction to Unix: Fundamental Commands

Introduction to Unix: Fundamental Commands Introduction to Unix: Fundamental Commands Ricky Patterson UVA Library Based on slides from Turgut Yilmaz Istanbul Teknik University 1 What We Will Learn The fundamental commands of the Unix operating

More information

Introduction to UNIX. Logging in. Basic System Architecture 10/7/10. most systems have graphical login on Linux machines

Introduction to UNIX. Logging in. Basic System Architecture 10/7/10. most systems have graphical login on Linux machines Introduction to UNIX Logging in Basic system architecture Getting help Intro to shell (tcsh) Basic UNIX File Maintenance Intro to emacs I/O Redirection Shell scripts Logging in most systems have graphical

More information

Linux Refresher (1) 310/ Fourth Workshop on Distributed Laboratory Instrumentation Systems (30 October - 24 November 2006)

Linux Refresher (1) 310/ Fourth Workshop on Distributed Laboratory Instrumentation Systems (30 October - 24 November 2006) 310/1779-4 Fourth Workshop on Distributed Laboratory Instrumentation Systems (30 October - 24 November 2006) Linux Refresher (1) Razaq Babalola IJADUOLA These lecture notes are intended only for distribution

More information

Table Of Contents. 1. Zoo Information a. Logging in b. Transferring files 2. Unix Basics 3. Homework Commands

Table Of Contents. 1. Zoo Information a. Logging in b. Transferring files 2. Unix Basics 3. Homework Commands Table Of Contents 1. Zoo Information a. Logging in b. Transferring files 2. Unix Basics 3. Homework Commands Getting onto the Zoo Type ssh @node.zoo.cs.yale.edu, and enter your netid pass when prompted.

More information

Shells and Shell Programming

Shells and Shell Programming Shells and Shell Programming 1 Shells A shell is a command line interpreter that is the interface between the user and the OS. The shell: analyzes each command determines what actions are to be performed

More information

Shell Programming Overview

Shell Programming Overview Overview Shell programming is a way of taking several command line instructions that you would use in a Unix command prompt and incorporating them into one program. There are many versions of Unix. Some

More information

Shells. A shell is a command line interpreter that is the interface between the user and the OS. The shell:

Shells. A shell is a command line interpreter that is the interface between the user and the OS. The shell: Shells A shell is a command line interpreter that is the interface between the user and the OS. The shell: analyzes each command determines what actions are to be performed performs the actions Example:

More information

5/8/2012. Exploring Utilities Chapter 5

5/8/2012. Exploring Utilities Chapter 5 Exploring Utilities Chapter 5 Examining the contents of files. Working with the cut and paste feature. Formatting output with the column utility. Searching for lines containing a target string with grep.

More information

CSCI2467: Systems Programming Concepts

CSCI2467: Systems Programming Concepts CSCI2467: Systems Programming Concepts Class activity: bash shell literacy Instructor: Matthew Toups Fall 2017 Today 0 Shells History Usage Scripts vs. Programs 1 Bash shell: practical uses for your systems

More information

Introduction to UNIX. Introduction. Processes. ps command. The File System. Directory Structure. UNIX is an operating system (OS).

Introduction to UNIX. Introduction. Processes. ps command. The File System. Directory Structure. UNIX is an operating system (OS). Introduction Introduction to UNIX CSE 2031 Fall 2012 UNIX is an operating system (OS). Our goals: Learn how to use UNIX OS. Use UNIX tools for developing programs/ software, specifically shell programming.

More information

Introduction to UNIX. CSE 2031 Fall November 5, 2012

Introduction to UNIX. CSE 2031 Fall November 5, 2012 Introduction to UNIX CSE 2031 Fall 2012 November 5, 2012 Introduction UNIX is an operating system (OS). Our goals: Learn how to use UNIX OS. Use UNIX tools for developing programs/ software, specifically

More information

1Z Oracle Linux Fundamentals (Oracle Partner Network) Exam Summary Syllabus Questions

1Z Oracle Linux Fundamentals (Oracle Partner Network) Exam Summary Syllabus Questions 1Z0-409 Oracle Linux Fundamentals (Oracle Partner Network) Exam Summary Syllabus Questions Table of Contents Introduction to 1Z0-409 Exam on Oracle Linux Fundamentals (Oracle Partner Network)... 2 Oracle

More information

Filesystem and common commands

Filesystem and common commands Filesystem and common commands Unix computing basics Campus-Booster ID : **XXXXX www.supinfo.com Copyright SUPINFO. All rights reserved Filesystem and common commands Your trainer Presenter s Name Title:

More information

System Programming. Introduction to Unix

System Programming. Introduction to Unix Content : by Dr. B. Boufama School of Computer Science University of Windsor Instructor: Dr. A. Habed adlane@cs.uwindsor.ca http://cs.uwindsor.ca/ adlane/60-256 Content Content 1 Introduction 2 3 Introduction

More information

Examples: Directory pathname: File pathname: /home/username/ics124/assignments/ /home/username/ops224/assignments/assn1.txt

Examples: Directory pathname: File pathname: /home/username/ics124/assignments/ /home/username/ops224/assignments/assn1.txt ULI101 Week 03 Week Overview Absolute and relative pathnames File name expansion Shell basics Command execution in detail Recalling and editing previous commands Quoting Pathnames A pathname is a list

More information

First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion.

First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion. Warnings Linux Commands 1 First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion. Read the relevant material

More information

Unix Tools / Command Line

Unix Tools / Command Line Unix Tools / Command Line An Intro 1 Basic Commands / Utilities I expect you already know most of these: ls list directories common options: -l, -F, -a mkdir, rmdir make or remove a directory mv move/rename

More information

Quick Start Guide. by Burak Himmetoglu. Supercomputing Consultant. Enterprise Technology Services & Center for Scientific Computing

Quick Start Guide. by Burak Himmetoglu. Supercomputing Consultant. Enterprise Technology Services & Center for Scientific Computing Quick Start Guide by Burak Himmetoglu Supercomputing Consultant Enterprise Technology Services & Center for Scientific Computing E-mail: bhimmetoglu@ucsb.edu Linux/Unix basic commands Basic command structure:

More information

Introduction to the Shell

Introduction to the Shell [Software Development] Introduction to the Shell Davide Balzarotti Eurecom Sophia Antipolis, France What a Linux Desktop Installation looks like What you need Few Words about the Graphic Interface Unlike

More information

M2PGER FORTRAN programming. General introduction. Virginie DURAND and Jean VIRIEUX 10/13/2013 M2PGER - ALGORITHME SCIENTIFIQUE

M2PGER FORTRAN programming. General introduction. Virginie DURAND and Jean VIRIEUX 10/13/2013 M2PGER - ALGORITHME SCIENTIFIQUE M2PGER 2013-2014 FORTRAN programming General introduction Virginie DURAND and Jean VIRIEUX 1 Why learning programming??? 2 Why learning programming??? ACQUISITION numerical Recording on magnetic supports

More information

CSC209. Software Tools and Systems Programming. https://mcs.utm.utoronto.ca/~209

CSC209. Software Tools and Systems Programming. https://mcs.utm.utoronto.ca/~209 CSC209 Software Tools and Systems Programming https://mcs.utm.utoronto.ca/~209 What is this Course About? Software Tools Using them Building them Systems Programming Quirks of C The file system System

More information

Lecture 4. Log into Linux Reminder: Homework 1 due today, 4:30pm Homework 2 out, due next Tuesday Project 1 out, due next Thursday Questions?

Lecture 4. Log into Linux Reminder: Homework 1 due today, 4:30pm Homework 2 out, due next Tuesday Project 1 out, due next Thursday Questions? Lecture 4 Log into Linux Reminder: Homework 1 due today, 4:30pm Homework 2 out, due next Tuesday Project 1 out, due next Thursday Questions? Tuesday, September 7 CS 375 UNIX System Programming - Lecture

More information

FREEENGINEER.ORG. 1 of 6 11/5/15 8:31 PM. Learn UNIX in 10 minutes. Version 1.3. Preface

FREEENGINEER.ORG. 1 of 6 11/5/15 8:31 PM. Learn UNIX in 10 minutes. Version 1.3. Preface FREEENGINEER.ORG Learn UNIX in 10 minutes. Version 1.3 Preface This is something that I had given out to students (CAD user training) in years past. The purpose was to have on one page the basics commands

More information

Bash Programming. Student Workbook

Bash Programming. Student Workbook Student Workbook Bash Programming Published by ITCourseware, LLC, 7245 South Havana Street, Suite 100, Englewood, CO 80112 Contributing Authors: Julie Johnson, Rob Roselius Editor: Jeff Howell Special

More information

(a) About Unix. History

(a) About Unix. History Part 1: The Unix Operating System (a) About Unix History First roots in the Bell Laboratories, early 60s Kernel rewrite in C by Ritchie / Thompson in the early 70s Source code licenses for Universities

More information

What is the Shell. Whenever you login to a Unix system you are placed in a program called the shell. All of your work is done within the shell.

What is the Shell. Whenever you login to a Unix system you are placed in a program called the shell. All of your work is done within the shell. What is the Shell Whenever you login to a Unix system you are placed in a program called the shell. All of your work is done within the shell. The shell is your interface to the operating system. It acts

More information

commandname flags arguments

commandname flags arguments Unix Review, additional Unix commands CS101, Mock Introduction This handout/lecture reviews some basic UNIX commands that you should know how to use. A more detailed description of this and other commands

More information

Name: Peter Lemieszewski Venue: Education

Name: Peter Lemieszewski Venue: Education z/tpf EE V1.1 z/tpfdf V1.1 TPF Toolkit for WebSphere Studio V3 TPF Operations Server V1.2 IBM Software Group TPF Users Group Fall 2006 LINUX FOR TPFERS Name: Peter Lemieszewski Venue: Education AIM Enterprise

More information

I/O and Shell Scripting

I/O and Shell Scripting I/O and Shell Scripting File Descriptors Redirecting Standard Error Shell Scripts Making a Shell Script Executable Specifying Which Shell Will Run a Script Comments in Shell Scripts File Descriptors Resources

More information

CS 460 Linux Tutorial

CS 460 Linux Tutorial CS 460 Linux Tutorial http://ryanstutorials.net/linuxtutorial/cheatsheet.php # Change directory to your home directory. # Remember, ~ means your home directory cd ~ # Check to see your current working

More information

S E C T I O N O V E R V I E W

S E C T I O N O V E R V I E W INPUT, OUTPUT REDIRECTION, PIPING AND PROCESS CONTROL S E C T I O N O V E R V I E W In this section, we will learn about: input redirection; output redirection; piping; process control; 5.1 INPUT AND OUTPUT

More information

Introduction to remote command line Linux. Research Computing Team University of Birmingham

Introduction to remote command line Linux. Research Computing Team University of Birmingham Introduction to remote command line Linux Research Computing Team University of Birmingham Linux/UNIX/BSD/OSX/what? v All different v UNIX is the oldest, mostly now commercial only in large environments

More information

First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion.

First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion. Warnings 1 First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion. Read the relevant material in Sobell! If

More information

A Brief Introduction to the Linux Shell for Data Science

A Brief Introduction to the Linux Shell for Data Science A Brief Introduction to the Linux Shell for Data Science Aris Anagnostopoulos 1 Introduction Here we will see a brief introduction of the Linux command line or shell as it is called. Linux is a Unix-like

More information

Shell. SSE2034: System Software Experiment 3, Fall 2018, Jinkyu Jeong

Shell. SSE2034: System Software Experiment 3, Fall 2018, Jinkyu Jeong Shell Prof. Jinkyu Jeong (Jinkyu@skku.edu) TA -- Minwoo Ahn (minwoo.ahn@csl.skku.edu) TA -- Donghyun Kim (donghyun.kim@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu

More information

Sperimentazioni I LINUX commands tutorial - Part II

Sperimentazioni I LINUX commands tutorial - Part II Sperimentazioni I LINUX commands tutorial - Part II A. Garfagnini, M. Mazzocco Università degli studi di Padova 24 Ottobre 2012 Streams and I/O Redirection Pipelines Create, monitor and kill processes

More information

Introduction to the Linux Command Line January Presentation Topics

Introduction to the Linux Command Line January Presentation Topics 1/22/13 Introduction to the Linux Command Line January 2013 Presented by Oralee Nudson ARSC User Consultant & Student Supervisor onudson@alaska.edu Presentation Topics Information Assurance and Security

More information

unix intro Documentation

unix intro Documentation unix intro Documentation Release 1 Scott Wales February 21, 2013 CONTENTS 1 Logging On 2 1.1 Users & Groups............................................. 2 1.2 Getting Help...............................................

More information

Unix Introduction to UNIX

Unix Introduction to UNIX Unix Introduction to UNIX Get Started Introduction The UNIX operating system Set of programs that act as a link between the computer and the user. Developed in 1969 by a group of AT&T employees Various

More information

Essential Unix and Linux! Perl for Bioinformatics, ! F. Pineda

Essential Unix and Linux! Perl for Bioinformatics, ! F. Pineda Essential Unix and Linux! Perl for Bioinformatics, 140.636! F. Pineda Generic computer architecture Memory Storage Fig. 1.2 From Designing Embedded Hardware, 2 nd Ed. by John Catsoulis OS concepts Shell

More information

Mills HPC Tutorial Series. Linux Basics I

Mills HPC Tutorial Series. Linux Basics I Mills HPC Tutorial Series Linux Basics I Objectives Command Line Window Anatomy Command Structure Command Examples Help Files and Directories Permissions Wildcards and Home (~) Redirection and Pipe Create

More information

Shells and Shell Programming

Shells and Shell Programming Shells and Shell Programming Shells A shell is a command line interpreter that is the interface between the user and the OS. The shell: analyzes each command determines what actions are to be performed

More information

Linux Essentials. Programming and Data Structures Lab M Tech CS First Year, First Semester

Linux Essentials. Programming and Data Structures Lab M Tech CS First Year, First Semester Linux Essentials Programming and Data Structures Lab M Tech CS First Year, First Semester Adapted from PDS Lab 2014 and 2015 Login, Logout, Password $ ssh mtc16xx@192.168.---.--- $ ssh X mtc16xx@192.168.---.---

More information

Unix File System. Learning command-line navigation of the file system is essential for efficient system usage

Unix File System. Learning command-line navigation of the file system is essential for efficient system usage ULI101 Week 02 Week Overview Unix file system File types and file naming Basic file system commands: pwd,cd,ls,mkdir,rmdir,mv,cp,rm man pages Text editing Common file utilities: cat,more,less,touch,file,find

More information

Introduction Variables Helper commands Control Flow Constructs Basic Plumbing. Bash Scripting. Alessandro Barenghi

Introduction Variables Helper commands Control Flow Constructs Basic Plumbing. Bash Scripting. Alessandro Barenghi Bash Scripting Alessandro Barenghi Dipartimento di Elettronica, Informazione e Bioingegneria Politecnico di Milano alessandro.barenghi - at - polimi.it April 28, 2015 Introduction The bash command shell

More information

Welcome to Linux. Lecture 1.1

Welcome to Linux. Lecture 1.1 Welcome to Linux Lecture 1.1 Some history 1969 - the Unix operating system by Ken Thompson and Dennis Ritchie Unix became widely adopted by academics and businesses 1977 - the Berkeley Software Distribution

More information

UNLV Computer Science Department CS 135 Lab Manual

UNLV Computer Science Department CS 135 Lab Manual UNLV Computer Science Department CS 135 Lab Manual prepared by Lee Misch revised July 2013 CS 135 Lab Manual Content Page Introduction 3 CS Computer Accounts. 3 TBE B361 Computer Basics. 3 Choosing an

More information

Basic Linux (Bash) Commands

Basic Linux (Bash) Commands Basic Linux (Bash) Commands Hint: Run commands in the emacs shell (emacs -nw, then M-x shell) instead of the terminal. It eases searching for and revising commands and navigating and copying-and-pasting

More information

GNU/Linux 101. Casey McLaughlin. Research Computing Center Spring Workshop Series 2018

GNU/Linux 101. Casey McLaughlin. Research Computing Center Spring Workshop Series 2018 GNU/Linux 101 Casey McLaughlin Research Computing Center Spring Workshop Series 2018 rccworkshop IC;3df4mu bash-2.1~# man workshop Linux101 RCC Workshop L101 OBJECTIVES - Operating system concepts - Linux

More information

CST Algonquin College 2

CST Algonquin College 2 The Shell Kernel (briefly) Shell What happens when you hit [ENTER]? Output redirection and pipes Noclobber (not a typo) Shell prompts Aliases Filespecs History Displaying file contents CST8207 - Algonquin

More information

A Brief Introduction to Unix

A Brief Introduction to Unix A Brief Introduction to Unix Sean Barag Drexel University March 30, 2011 Sean Barag (Drexel University) CS 265 - A Brief Introduction to Unix March 30, 2011 1 / 17 Outline 1 Directories

More information

Environment Variables

Environment Variables Environment Variables > the shell has variables: my_var="some_value" > no space allowed around "=" echo $my_var > dereferencing by prepending a "$" > more generally: ${my_var} > shell variables can be

More information

S E C T I O N O V E R V I E W

S E C T I O N O V E R V I E W PROGRAM CONTROL, FILE ARCHIVING, ENVIRONMENT AND SCRIPTS S E C T I O N O V E R V I E W Continuing from last section, we are going to learn about the following concepts: controlling programs; working with

More information

Week 2 Lecture 3. Unix

Week 2 Lecture 3. Unix Lecture 3 Unix Terminal and Shell 2 Terminal Prompt Command Argument Result 3 Shell Intro A system program that allows a user to execute: shell functions (e.g., ls -la) other programs (e.g., eclipse) shell

More information

BIOINFORMATICS POST-DIPLOMA PROGRAM SUBJECT OUTLINE Subject Title: OPERATING SYSTEMS AND PROJECT MANAGEMENT Subject Code: BIF713 Subject Description:

BIOINFORMATICS POST-DIPLOMA PROGRAM SUBJECT OUTLINE Subject Title: OPERATING SYSTEMS AND PROJECT MANAGEMENT Subject Code: BIF713 Subject Description: BIOINFORMATICS POST-DIPLOMA PROGRAM SUBJECT OUTLINE Subject Title: OPERATING SYSTEMS AND PROJECT MANAGEMENT Subject Code: BIF713 Subject Description: This course provides Bioinformatics students with the

More information