CS 307: UNIX PROGRAMMING ENVIRONMENT REVIEW FOR EXAM 2

Size: px
Start display at page:

Download "CS 307: UNIX PROGRAMMING ENVIRONMENT REVIEW FOR EXAM 2"

Transcription

1 CS 307: UNIX PROGRAMMING ENVIRONMENT REVIEW FOR EXAM 2 Prof. Michael J. Reale Fall 2014

2 EXAM 2 OVERVIEW

3 Exam 2 Material Exam 2 will cover the following: REVIEW slides from (8) to (17) (INCLUSIVE) THIS MEANS IT OVERLAPS WITH MATERIAL FROM THE FIRST EXAM!!! REVIEW 08 (both parts) and 09 Questions from Exam 1 pertaining to 08 and 09 Quizzes 3 and 4 VARIABLE practice REGEX practice It may also cover anything we ve touched on in the katas or labs

4 This Slide Deck This slide deck includes: REVIEW slides 08 through 17 inclusive Quiz overview 3-4 It does NOT include: Variable Practice Regex Practice The Katas from 08 through 17 includes The last 3 will be separate slides posted on the website

5 REVIEW (8) (Both parts) Advanced Shell Usage: Variables

6 Two Shell Families Bourne family (including sh, bash, and ksh) C-Shell family (including csh and tcsh)

7 What shell am I using? echo $0 Shell you are currently using echo $SHELL Default shell

8 Shell: Interactive AND Non-Interactive Interactive shell User submitting commands / getting feedback Login shells Non-interactive shell Shell runs shell script and terminates when done

9 Processes Process a specific instance of a program that is executing Contains information about the running program Can have multiple instances of same program each instance is its own process

10 ps command ps Shows the currently running processes By default, only shows your processes ps a Shows ALL currently running processes attached to a terminal

11 Parents and Children Example: run vi from your shell The shell process is the parent process (or parent) The vi process is the child process (or child)

12 Variables and Environment Variable thing that holds information Name identifier for the variable Value data stored in the variable Environment table of variables a process has access to

13 Variables in Unix Name Only letters, numbers, and underscore Must begin with letter or underscore Value almost always character string

14 Variables in Unix Can do the following with variables Create them Get value from them Change value Destroy them

15 Variables in Unix Two types of variables in Unix: Environment variables Shell variables

16 Environment and Shell Variables Environment variables Variables part of process s environment Similar to global variables in programming Passed from parent process to child process Shell variables Local to the currently running shell NOT passed down to child processes

17 Listing Variables env lists all environment variables set lists all shell variables

18 Printing the Value of a Variable Use $ to get value and echo command Example: echo $SHELL To be very clear, use curly braces {} Example: echo ${SHELL}

19 General Variable Information Environment variables only propagate DOWN the process tree (values do NOT go up the tree) Some variables have means as both local (shell) variables and global (environment) variables Bourne family vs. C-Shell family on how to handle this

20 C-Shell Family Variables A variable is either local OR global Shell variable local By convention, lowercase set myvar= Hello unset destroy shell variable Environment variable global By convention, UPPERCASE setenv MYVAR Hello unsetenv destroy environment variable Exception: certain special variables (both global and local copies)

21 Bourne Family Variables A variable is either local or local+global Shell variables local MYVAR= Hello new variable = shell variable by default Environment variables local AND global export MYVAR makes shell variable environment variable (local+global) export MYVAR= Hi set and export at same time ALL variables UPPERCASE names by convention unset destroys variable

22 Printing Variables env set Both shell families: prints all environment variables C-Shell: print all shell variables Bourne: print all shell variables AND environment variables (environment variables = both)

23 PATH variable PATH list of directories shell searches for command Bourne environment variable C-Shell dual shell/environment variables (path/path)

24 Controlling Shell Behavior C-Shell use shell variables Bourne use shell options set o (turn on) or set +o (turn off) Commands by themselves display options

25 REVIEW (9) Quoting/Escaping, Command Substitution, and Search Path

26 Metacharacters Certain characters have special meaning in the shell Examples: $ ;? * To print characters, must quote/escape them

27 \, Strong Quotes, and Weak Quotes \ (backslash) = escape character Works on anything (single quotes) = strong quotes Escapes/quotes everything (double quotes) weak quotes Quotes everything EXCEPT $ (dollar), ` (backquote), and \ (backslash)

28 Command Substitution ` (backquote) command substitution Example: set myshell=`basename ${SHELL}` NOTE: Must use backquotes on both ends!

29 Search PATH PATH variable shell searches in these directories for commands; stops when command found To add to path (ex: $HOME/bin): Bourne: export PATH= $PATH:$HOME/bin C-Shell: set path = ($path $HOME/bin) Can also add current directory. (Dot) Add on end DO NOT ADD AT ALL AS ROOT USER!

30 REVIEW (10) Streams, Pipes, and Redirection

31 Unix Philosophy Simple tools that do one thing very well Chain them together to do more complex things

32 Filters Filter program that can: Take input from any source Write output to any target Chained together to do more complex tasks

33 Streams Stream = source or destination of data Three streams are available to all programs: Standard Input (0, STDIN) Regular program input Standard Output (1, STDOUT) Regular program output Standard Error (2, STDERR) Program error output

34 Redirection Redirect streams get input from file OR send output to file > Redirect STDOUT to file (overwrite file) >> Redirect STDOUT to file (append to file) < Redirect file to STDIN

35 Clobbering Clobbering overwriting file because of redirect To prevent clobbering: C-Shell: set noclobber (turn off unset noclobber) Bourne: set o noclobber (turn off set +o noclobber) To override noclobbering: >! E.g., echo Howdy >! myfile

36 Piping Piping Chaining commands together (output of first command input of second) Send STDOUT of one command as STDIN to another with the (pipe) symbol First must write to STDOUT; second must read from STDIN

37 Tee tee sends data to STDOUT, but also saves data to a file Example: df grep da0 tee fs df grep da0 tee STDOUT fs

38 Sequence of Commands Separate commands by ; Performs a sequences of commands No input/output shared; no direct relationship

39 Grouped Commands Grouped commands: (command1; command2) Sequence of commands run in sub-shell Creates a new shell temporarily Output of all commands combined: E.g., (echo Today is `date` ; cal ) > mycal

40 File Descriptors File descriptor numerical identifier for every input/output within a Unix process Three predefined file descriptors provided to all Unix processes: 0 STDIN 1 STDOUT 2 STDERR

41 The Bourne Redirection Can redirect with file descriptor and <, >, or >> command 0< inputfile Redirect STDIN command 1> outputfile Redirect STDOUT command 2> errorfile Redirect STDERR

42 The Bourne Combination Redirect both STDOUT and STDERR ALL BOURNE SHELLS: command 1> outputfile 2>&1 MUST do 1> FIRST, then 2>&1 BASH: &> or >& command &> outputfile If appending: command >> outputfile 2>&1

43 C-Shell Redirection Redirect both STDOUT and STDERR, use >& E.g., sort >& output Redirect ONLY STDERR, need to use subshell: E.g., (sort > output) >& errors

44 REVIEW (11) Filters Overview

45 Filters Filter program that can: Take input from any source Write output to any target Simple tools chained together to do more complex tasks

46 Common Filters cat = simplest filter just prints data head = display lines from beginning of a file tail = display lines from end of a file grep = finds matching patterns (grep pattern) ^ = line begins with $ = line end with

47 Common Filters (continued) cut = cut out columns of data -d delimiter (defaults to tab) -f field -c cut at character positions sort = sort lines of text files uniq = filter out repeated lines in a file Must be sorted before showing unique values wc = counts words, lines, characters, and/or bytes -l line count

48 Comparing Files cmp compares two files byte by byte Usually used for binary files comm shows lines that the same, only in one file, or only in the other file (shows 3 columns) FILES MUST BE SORTED diff compares unsorted (text) files line by line Gives instructions to turn first file into second file Combined with patch to apply (and undo) changes Very useful for code projects

49 REVIEW (12) History and Aliases

50 History List History List where shell saves command history Each command event with event number Bourne family: fc commands C-Shell family: history and! Commands Bash: both

51 Bourne History Commands Bourne: Display fc l Re-execute event number 24 fc s 24 Re-execute last command fc s Replace pattern and re-execute number fc s pattern=replacement number Replace pattern and re-execute last fc s pattern=replacement Bonus: fc = fix command

52 C-Shell History Commands C-Shell: Display history Re-execute event number 24!24 Re-execute last command!! Replace pattern and re-execute!number:s/pattern/replacement Replace pattern and re-execute last ^pattern^replacement

53 Saving History Is history saved and restored after logging in again? Bourne: yes C-Shell: only if the shell variable savehist is set Need to tell it how many commands to save set savehist=30

54 Setting History Size Bourne: HISTSIZE variable export HISTSIZE=50 C-Shell: history shell variable set history=50

55 Alias Alias = name you give to a command or list of commands Bourne: alias name=commands No spaces between name, =, and commands C-Shell: alias name commands No equal sign NOTE: Use single quotes on commands

56 Alias Change value by redefining alias See current value alias name See ALL aliases alias Remove alias unalias name Remove ALL aliases Bourne: unalias a C-Shell: unalias *

57 Startup Files and Aliases Aliases NOT saved when you log out Also do NOT propagate down to child shells Ergo, usually define aliases in shell startup files

58 Suspending an Alias To suspend an alias temporarily, use the escape character (\) \name

59 REVIEW (13) Find Command

60 find Command find path test action Find files/folders in a directory tree Find executes a 3-step process: 1) Path: find looks in each path listed Searches entire directory tree in each path 2) Test: For each file, applies the tests you specify Goal = create list of files matching criteria 3) Action: once search complete, carries out actions specified on each file in list

61 Paths You can specify multiple paths: Example: find /bin /sbin /usr/bin name b* Prints out all files and directories in /bin, /sbin, and /usr/bin that begin with the letter b

62 Tests Most basic tests -type looks for a type of file -type d = directory -type f = ordinary file -name pattern matches name to pattern Can use wildcards (?,*,[]), but must single-quote them Case-sensitive (to ignore case, use iname) Negate test with! before test Must escape with \! or!

63 Actions Common actions: -print prints (default) -fprint file print to file -ls display long directory listing -fls file ls to file -delete deletes the found files Can have multiple actions

64 -exec and ok Actions -exec command {} \; Allows you to execute any command on the pathname command = the command you wish to execute {} = placeholder for file pathname May have to quote: {} \; = needed to end command; must be escaped -ok same as exec, but asks before executing command

65 xargs Command xargs Separate program that runs any command you specify on arguments from STDIN Use pipe to connect it to output from find

66 REVIEW (14) Advanced chmod (and some extra material)

67 chmod Advanced chmod who=permissions filename u = user (owner), g = group, o = others (world), a = all r = read, w = write, x = execute Can also subtract and add permissions: chmod who+permissions filename chmod who-permissions filename

68 chmod Advanced (cont.) Can set permissions of one entity equal to another chmod who=someoneelse filename Can do multiple things at once: E.g., chmod u+w,o-x myfile Can also set user ID: E.g., chmod u+s myprogram

69 rm vs. rmdir rm Removes files Removes directories using r option (recursive delete) This will delete empty OR non-empty directories rmdir ONLY removes empty directories

70 mv Command mv Used to move AND rename files Rename use different filename for destination E.g., mv file1 file2 Renames file1 to file2

71 del Command Actually a DOS command Happens to be aliased to rm on Fang HOWEVER, you cannot assume this all the time!

72 [] vs. {} [ab] Matches SINGLE characters (or range of characters) This will match character a OR character b {ab} Matches STRINGS separated by commas This will match string ab

73 Wildcards in [] and {} [a*,b*] Wildcards NOT interpreted in square braces [] This is interpreted as character a OR character * OR character, OR character b OR character * {a*,b*} Wildcards interpreted in curly braces {} This will fit files that begin with a or b

74 Using Metacharacters REMEMBER: In general, to treat a metacharacter as an actual character to match, use quoting/escaping! touch A* touch A* touch A\*

75 [^] Wildcard [^] Negates pattern that inside square brackets E.g., ls [^ab]* Find files that do NOT begin with a or b

76 Hard vs. Soft Links Hard links Can ONLY point to file inodes in the SAME filesystem Soft links Points to path of files OR directories These could be in the same OR a different filesystem

77 REVIEW (15) Process Fundamentals

78 Processes Defined Process Instance of a program that s running Includes program data and info about running program Each has a process ID (PID) and entry in process table Kernel manages processes and process table

79 Scheduler Scheduler Service in the kernel Maintains list of processes waiting to run Determines who gets to run next Chooses a process, lets it run for a time slice, then pauses process and picks another Processing time = CPU time

80 System Calls System Calls Allow processes to access kernel services E.g., file I/O, creating processes, etc. Used in programming Lots of system calls ( ), but usually only a few really important ones

81 Process-Related System Calls The most important process-related system calls are: fork creates copy of current process exec changes the program the process is running wait pause until another process is finished exit terminates a process With one notable exception, every process is created by another process

82 The Shell Again Your shell is just another process To see the process ID of your current shell: echo $$

83 Internal and External Commands Commands can be: Internal built into shell; not really separate programs E.g., history External separate programs; shell creates processes to run them

84 Running External Commands The shell takes the following steps to run an external command: 1) parent (shell) calls fork Creates child process that is a copy of the current shell 2) child calls exec Changes program of child process from shell to desired program 3) parent (shell) calls wait Parent pauses itself until child finishes running 4) child calls exit Child finishes running, and the parent (shell) starts running again

85 Running External Commands Example: who

86 Zombie Process Zombie process What s left after a process dies and resources are deallocated Still has entry in process table When parent wakes up tells kernel to remove entry

87 Orphan Process Orphan process When parent dies unexpectedly and child continues to execute Automatically adopted by process #1 (init process) Init will kill zombie orphans

88 Bad Parenting If the parent does not call wait, zombie child will never die To fix: Kill parent Zombie child becomes orphan zombie Init process adopts and kills orphan zombie

89 The Idle Process Idle Process (Process #0) Creates without forking near end of boot procedure by kernel Performs some important functions Forks to create process #1 Execs to run simple do-nothing program (hence, idle ) When nothing needs to be done, system runs idle process Ironically, system does not acknowledge its existence after this

90 The Init Process Init Process (Process #1) Finishes boot procedure Runs program called init Ancestor of all other processes in the system Never stops running Performs tasks from time to time like slaughtering zombie orphan children

91 Background Process To run a command in the background, add an ampersand (&) to the end of the command: Without the ampersand, process would run in the foreground

92 I/O and Background Processes When running in background: Standard input is disconnected Standard output/error STILL connected

93 REVIEW (16) Job Control and Process Management

94 Job Control Defined Job control Introduced by Bill Joy when he created C-Shell Can run one process in foreground and many processes in background Can pause and restart processes as needed See status of processes

95 Job vs. Process Process = single instance of a program running Kernel handles process table Job = all processes necessary to run a command string (E.g., date; who; call job with 3 processes) Has job number (or job ID) and entry in job table Shell handles job table

96 Running a Background Job To run job in background put ampersand (&) on end Example: who sort uniq c & Will print [job ID] and process ID of last process in command string Shell will notify you when job is done (at next available prompt) If notify set, tells you immediately

97 States of Jobs Every job is in one of three states: Running in foreground Running in background Paused or Suspended or Stopped NOTE: Stopped does NOT mean Killed or Terminated a stopped job can be resumed

98 Suspending and Resuming a Foreground Job To suspend a foreground job: CTRL+Z To resume the job: fg command By default, resumes last job you suspended

99 What Happens When You Logout? When you logout, all suspended jobs are terminated automatically. Shell will warn you once, then let you quit on second try.

100 Suspending a Shell To pause the shell you are in suspend command One restriction: cannot suspend your login shell (unless you use the f option)

101 Job Listings jobs command Lists all jobs currently running (or suspended/stopped) current job (+) Default job for fg and bg Most recently suspended or mostly recently moved to background previous job (-) Job directly before current job -l gives long listing (includes process ID)

102 fg Command fg command Moves a job to the foreground Has three basic forms: fg fg % % The % part can have several variations (shown on next slide)

103 fg Command Revisited (cont.) % OR %+ Current job %- Previous job %n Job with job ID n %name Job with name at beginning of command %?name Job that has name ANYWHERE in the command string WARNING: The? is NOT used the same way that it usually is in wildcard globbing!

104 bg Command bg Command Moves a job to the background By default, moves current job to background To specify job number, put %num after it Example: bg %5 Move job 5 to background Can move several jobs to background Example: bg %2 %5 %7

105 TO CLARIFY When a job is SUSPENDED with CTRL+Z, it is paused (and can be resumed) When a job is in the FOREGROUND or BACKGROUND, it is running When a job is TERMINATED with CTRL+C (or the kill command), it is dead

106 ps Command Revisited ps command Lists status of processes Two sets of options: UNIX options descended from AT&T Unix BSD options descended from BSD Many modern versions support both sets of options (e.g., Linux) Also GNU options as well

107 ps By Default ps By default, lists all processes running under your userid from your terminal

108 ps UNIX Options ps a Lists processes associated with ANY userid AND a terminal ps e Lists ALL processes (including daemons) ps p pid Process with process ID pid ps u userid Processes associated with specified userid

109 ps BSD Options ps a Lists processes associated with ANY userid AND a terminal ps ax Lists ALL processes (including daemons) ps p pid Process with process ID pid ps U userid Processes associated with specified userid ps u OR ps l Displays different long output versions (more columns)

110 STAT Column of ps Output STAT = process state The following are for Linux and FreeBSD: R = running T = suspended Z = zombie; terminated, parent not waiting S = interruptible sleep: waiting for event to complete D = uninterruptible sleep: waiting for event to complete (like disk I/O) I = idle (FreeBSD only)

111 Monitoring System Processes Live To see stats for the processes while they run, use the top command -s time set delay time (default: 2 seconds) -d count sets the number of times to refresh (default: unlimited) WARNING: The book lists different options!

112 kill Command kill [-signal] pid Used to terminate processes Can use process ID or job ID More generally, sends signal to a process By default, sends TERM (terminate) signal Can be caught by program To kill something immediately, send -9 (or SIGKILL) CANNOT be caught by program May result in data loss (unclosed files), unreleased memory, etc.

113 Signals Defined Signal Simple form of interprocess communication (IPC) Number sent to a process event occurred Trapping a signal = when the process recognizes the signal and does something about it Some signals cannot be trapped (like SIGKILL)

114 System Signals There are several different signals: # Name Abbrv. Description 1 SIGHUP HUP Hang-up: sent when you log-out or terminal disconnects 2 SIGINT INT Interrupt: sent when you press CTRL+C 9 SIGKILL KILL Kill: immediate termination; cannot be trapped by a process 15 SIGTERM TERM Terminate: request to terminate; can be trapped by a process 18 SIGCONT CONT Continue: resume suspended process; sent by fg or bg 19 SIGSTOP STOP Stop (suspend): sent when you press CTRL+Z

115 nice command nice [-n adjustment] command Runs the given command as reduced priority -n set nice number or niceness (0 to 19) 19 lowest priority the most nice you can be If superuser, can use reverse nice number (-1 to -20) -20 highest priority not nice at all

116 renice command renice niceness p pid Set niceness of existing process with process ID pid Example: renice 19 p 404 Give process 404 the lowest priority possible

117 Why be nice? You may have long-running processes that you don t want hogging resources use nice (or renice) to reduce priority

118 Daemons Daemons Process that runs disconnected from a terminal and provide services for the system The init process is a very basic example Most others created during last part of boot sequence by init Others are orphan processes (adopted by init) Often wait silently in background for something to happen then, wakes up, does the thing, and goes back to sleep Similar to Windows services

119 REVIEW (17) Regular Expressions

120 Regular Expressions Defined Regular Expressions Used to specify a pattern of characters VERY powerful; used for: Pattern matching Complex substitutions Input verification Used in grep/egrep, sed, vi, less, and many programming languages Also called regex or RE

121 Matching and Anchors Match when regex corresponds to string of characters All ordinary (non-meta) characters match themselves Should ALWAYS single-quote pattern! Anchors matching beginning/end of something ^ beginning of line $ end of line \< beginning of word \> end of word

122 Words Word in regular expressions More flexible than in English Self-contained, contiguous sequence of characters consisting of letters, numbers, or underscore (_) Examples: ring Frodo Gandalf Dark_Lord

123 Matching Single Characters. (Dot) ANY single character [] character class; gives options for a single character Either single characters, range of characters, or both Can be negated with ^ [^Aa] = not A or a

124 Predefined Character Classes [:lower:] = lowercase letters [a-z] [:upper:] = uppercase letters [A-Z] [:alpha:] = upper and lowercase letters [A-Za-z] [:digit:] = numbers [0-9] [:alnum:] = letters and numbers [A-Za-z0-9] [:punct:] = punctuation characters [:blank:] = space or Tab (whitespace) To use, you have to include the square brackets twice: Example: grep [[:alpha:]]ne

125 Repetition Operators To repeat something, you use a repetition operator * (Star) zero or more + (Plus) one or more? (Question Mark) zero or one {} specify number of occurrences (create bound) {n} match exactly n times {n, } match n or more times {, m} match m or fewer times (not standard) {n, m} match n to m times May be used with single characters, character classes, or groups Works on whatever is directly before it

126 Groups and Alternation Group Made using parentheses () Can use ANY of the preceding repetition operators on groups! (vertical bar) allows alternation of patterns E.g., ring stone ring OR stone

127 Matching a Metacharacter To match a metacharacter, use the escape character \ To match the escape character \\

128 QUIZ 3

129 Quiz 3: Question 1 Notions of space: Amount of data in file Number of blocks in filesystem Number of allocation units on disk NOT notion of space: Number of characters in pathname

130 Quiz 3: Question 2 Determine how much free space is left on hard disks df

131 Quiz 3: Question 3 Get space taken up by directory and ALL of its contents (i.e., entire directory tree at this point) du

132 Quiz 3: Question 4 Command to login as root user (super-user): su

133 Quiz 3: Question 5 Command to execute a single command as the super-user: sudo

134 Quiz 3: Question 6 Every file is owned by a user and a group.

135 Quiz 3: Question 7 Owner read, write, execute Group, World no permissions chmod 700 myfile

136 Quiz 3: Question 8 Owner, group, world read, write chmod 666 myfile

137 Quiz 3: Question 9 Owner read, write, execute Group, world read, execute chmod 755 myfile

138 Quiz 3: Question 10 Owner, group read, write World no permissions chmod 660 myfile

139 Quiz 3: Question 11 Owner, group, world read, write, execute chmod 777 myfile

140 Quiz 3: Question 12 Owner read, execute Group, world read only chmod 544 myfile

141 Quiz 3: Question 13 Owner, group NO permissions World read, execute Chmod 005 myfile

142 Quiz 3: Question 14 Owner, group, world NO permissions Chmod 000 myfile

143 Quiz 3: Question 15 Owner read, write, execute Group read, execute World NO permissions Chmod 750 myfile

144 Quiz 3: Question 16 Long listing of contents of directory: ls l

145 Quiz 3: Question 17 (Bonus) Command to show user ID, user name, primary group ID/name, supplementary group IDs/names: id

146 QUIZ 4

147 Quiz 4: Question 1 Four things you can do with a variable in Unix (generally): Create Set value Get value Destroy

148 Quiz 4: Question 2 Environment variable passed down to child processes The child process may or may not be another shell Shell variables NOT passed down to child processes Environment variables are ONLY visible to another shell if that other shell is a CHILD of the current shell So, if one shell defines a variable (environment or otherwise), a sibling or cousin shell on the process tree does NOT see it.

149 Quiz 4: Question 3 When you type a command (without a full pathname), shell looks for command in a list of directories. This list of directories is stored in the PATH variable

150 Quiz 4: Question 4 Print value of variable HEISENBERG echo $HEISENBERG REMEMBER: When you want to get the value of a variable, use the dollar sign and name: $HEISENBERG When you want to set the value of a variable, you just use the name itself: HEISENBERG

151 Quiz 4: Question 5 echo Kajit has wares, if you have $$$ NEED strong quotes (single quotes), because we want to print the dollar signs ($)

152 Quiz 4: Question 6 Print ALL environment variables env Print ALL shell variables set

153 Quiz 4: Questions 7-11 Assume you are using a C-Shell (like csh or tcsh) C-Shells set their variables; also setenv.

154 Quiz 4: Question 7 Create shell variable named ninjamode set ninjamode The variable does NOT have a value (or rather, the value is just an empty string) Mostly, the variable just EXISTS.

155 Quiz 4: Question 8 Destroy the shell variable ninjamode unset ninjamode

156 Quiz 4: Question 9 Create a shell variable named pines with value Dipper, Mabel, & Stan set pines= Dipper, Mabel, & Stan Could use strong (single) or weak (double) quotes here The ampersand (&) and the spaces will still be quoted. cb /gravityfalls/images/1/16/ Main_characters_of_Gravity_Falls.png

157 Quiz 4: Question 10 Create an environment variable named MYSTERY_SHACK with value Wendy, Soos, Dipper, Mabel, & Stan using next text and previous variable $pines setenv MYSTERY_SHACK Wendy, Soos, $pines

158 Quiz 4: Question 11 Destroy the environment variable named MYSTERY_SHACK unsetenv MYSTERY_SHACK

159 Quiz 4: Questions Assume you are using a Bourne shell (sh, bash, ksh) Bourne became an environmental export.

160 Quiz 4: Question 12 Create a shell variable named GRIMES with value Rick GRIMES=Rick No spaces (or other metacharacters), so quotes are optional here.

161 Quiz 4: Question 13 Set the value of GRIMES to equal Rick and Lori using new text and the previous value of $GRIMES GRIMES= $GRIMES and Lori Need to use weak quotes (double quotes) because we WANT $ to be interpreted by shell!

162 Quiz 4: Question 14 Make GRIMES an environment variable export GRIMES GRIMES still has the same value from before ( Rick and Lori )

163 Quiz 4: Question 15 Change the value of GRIMES to Coral GRIMES=Coral You don t have to use export again, although you could if you wanted to: export GRIMES=Coral

164 Quiz 4: Question 16 Destroy the variable GRIMES unset GRIMES In Bourne shells, unset is used to destroy both shell AND environment variables

165 Quiz 4: Question 17 (Bonus) Which specific metacharacters will NOT be escaped by weak quotes (double quotes)? $ (dollar sign) \ (escape character) ` (backquote)

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

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

Command-line interpreters

Command-line interpreters Command-line interpreters shell Wiki: A command-line interface (CLI) is a means of interaction with a computer program where the user (or client) issues commands to the program in the form of successive

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

Bashed One Too Many Times. Features of the Bash Shell St. Louis Unix Users Group Jeff Muse, Jan 14, 2009

Bashed One Too Many Times. Features of the Bash Shell St. Louis Unix Users Group Jeff Muse, Jan 14, 2009 Bashed One Too Many Times Features of the Bash Shell St. Louis Unix Users Group Jeff Muse, Jan 14, 2009 What is a Shell? The shell interprets commands and executes them It provides you with an environment

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

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

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

System Administration

System Administration Süsteemihaldus MTAT.08.021 System Administration UNIX shell basics Name service DNS 1/69 Command Line Read detailed manual for specific command using UNIX online documentation or so called manual (man)

More information

Standard. Shells. tcsh. A shell script is a file that contains shell commands that perform a useful function. It is also known as shell program.

Standard. Shells. tcsh. A shell script is a file that contains shell commands that perform a useful function. It is also known as shell program. SHELLS: The shell is the part of the UNIX that is most visible to the user. It receives and interprets the commands entered by the user. In many respects, this makes it the most important component of

More information

5/8/2012. Specifying Instructions to the Shell Chapter 8

5/8/2012. Specifying Instructions to the Shell Chapter 8 An overview of shell. Execution of commands in a shell. Shell command-line expansion. Customizing the functioning of the shell. Employing advanced user features. Specifying Instructions to the Shell Chapter

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

Process Management forks, bombs, zombies, and daemons! Lecture 5, Hands-On Unix System Administration DeCal

Process Management forks, bombs, zombies, and daemons! Lecture 5, Hands-On Unix System Administration DeCal Process Management forks, bombs, zombies, and daemons! Lecture 5, Hands-On Unix System Administration DeCal 2012-10-01 what is a process? an abstraction! you can think of it as a program in the midst of

More information

Module 8 Pipes, Redirection and REGEX

Module 8 Pipes, Redirection and REGEX Module 8 Pipes, Redirection and REGEX Exam Objective 3.2 Searching and Extracting Data from Files Objective Summary Piping and redirection Partial POSIX Command Line and Redirection Command Line Pipes

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

CS 307: UNIX PROGRAMMING ENVIRONMENT KATAS FOR EXAM 2

CS 307: UNIX PROGRAMMING ENVIRONMENT KATAS FOR EXAM 2 CS 307: UNIX PROGRAMMING ENVIRONMENT KATAS FOR EXAM 2 Prof. Michael J. Reale Fall 2014 COMMAND KATA 7: VARIABLES Command Kata 7: Preparation First, go to ~/cs307 cd ~/cs307 Make directory dkata7 and go

More information

APPLIED INFORMATICS Processes. Bash characteristics. Command type. Aliases.

APPLIED INFORMATICS Processes. Bash characteristics. Command type. Aliases. Lab 3 APPLIED INFORMATICS Processes. Bash characteristics. Command type. Aliases. Today... /proc /run 1. PROCESSES 2. BASH CHARACTERISTICS 3. COMMAND TYPES 4. ALIASES $$ $PPID pidof ps pgrep kill killall

More information

Linux shell scripting Getting started *

Linux shell scripting Getting started * Linux shell scripting Getting started * David Morgan *based on chapter by the same name in Classic Shell Scripting by Robbins and Beebe What s s a script? text file containing commands executed as a unit

More information

ITST Searching, Extracting & Archiving Data

ITST Searching, Extracting & Archiving Data ITST 1136 - Searching, Extracting & Archiving Data Name: Step 1 Sign into a Pi UN = pi PW = raspberry Step 2 - Grep - One of the most useful and versatile commands in a Linux terminal environment is the

More information

bash, part 3 Chris GauthierDickey

bash, part 3 Chris GauthierDickey bash, part 3 Chris GauthierDickey More redirection As you know, by default we have 3 standard streams: input, output, error How do we redirect more than one stream? This requires an introduction to file

More information

The UNIX Shells. Computer Center, CS, NCTU. How shell works. Unix shells. Fetch command Analyze Execute

The UNIX Shells. Computer Center, CS, NCTU. How shell works. Unix shells. Fetch command Analyze Execute Shells The UNIX Shells How shell works Fetch command Analyze Execute Unix shells Shell Originator System Name Prompt Bourne Shell S. R. Bourne /bin/sh $ Csh Bill Joy /bin/csh % Tcsh Ken Greer /bin/tcsh

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

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

The Online Unix Manual

The Online Unix Manual ACS-294-001 Unix (Winter Term, 2018-2019) Page 14 The Online Unix Manual Unix comes with a large, built-in manual that is accessible at any time from your terminal. The Online Manual is a collection of

More information

QUESTION BANK ON UNIX & SHELL PROGRAMMING-502 (CORE PAPER-2)

QUESTION BANK ON UNIX & SHELL PROGRAMMING-502 (CORE PAPER-2) BANK ON & SHELL PROGRAMMING-502 (CORE PAPER-2) TOPIC 1: VI-EDITOR MARKS YEAR 1. Explain set command of vi editor 2 2011oct 2. Explain the modes of vi editor. 7 2013mar/ 2013 oct 3. Explain vi editor 5

More information

CS 307: UNIX PROGRAMMING ENVIRONMENT REVIEW FOR EXAM 1

CS 307: UNIX PROGRAMMING ENVIRONMENT REVIEW FOR EXAM 1 CS 307: UNIX PROGRAMMING ENVIRONMENT REVIEW FOR EXAM 1 Prof. Michael J. Reale Fall 2014 EXAM 1 OVERVIEW Exam 1 Material Exam 1 will cover the following: REVIEW slides from (1) to (9) (INCLUSIVE) Quizzes

More information

elinks, mail processes nice ps, pstree, top job control, jobs, fg, bg signals, kill, killall crontab, anacron, at

elinks, mail processes nice ps, pstree, top job control, jobs, fg, bg signals, kill, killall crontab, anacron, at Processes 1 elinks, mail processes nice ps, pstree, top job control, jobs, fg, bg signals, kill, killall crontab, anacron, at 2 elinks is a text-based (character mode) web browser we will use it to enable

More information

UNIX COMMANDS AND SHELLS. UNIX Programming 2015 Fall by Euiseong Seo

UNIX COMMANDS AND SHELLS. UNIX Programming 2015 Fall by Euiseong Seo UNIX COMMANDS AND SHELLS UNIX Programming 2015 Fall by Euiseong Seo What is a Shell? A system program that allows a user to execute Shell functions (internal commands) Other programs (external commands)

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

Unix/Linux: History and Philosophy

Unix/Linux: History and Philosophy Unix/Linux: History and Philosophy History and Background Multics project Unix Linux Multiplexed Information and Computing Service Collaborative venture between General Electric, Bell Telephone Labs, and

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

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 Kernel. UNIX History

UNIX Kernel. UNIX History UNIX History UNIX Kernel 1965-1969 Bell Labs participates in the Multics project. 1969 Ken Thomson develops the first UNIX version in assembly for an DEC PDP-7 1973 Dennis Ritchie helps to rewrite UNIX

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

Most of the work is done in the context of the process rather than handled separately by the kernel

Most of the work is done in the context of the process rather than handled separately by the kernel Process Control Process Abstraction for a running program Manages program s use of memory, cpu time, and i/o resources Most of the work is done in the context of the process rather than handled separately

More information

Crash Course in Unix. For more info check out the Unix man pages -orhttp://www.cs.rpi.edu/~hollingd/unix. -or- Unix in a Nutshell (an O Reilly book).

Crash Course in Unix. For more info check out the Unix man pages -orhttp://www.cs.rpi.edu/~hollingd/unix. -or- Unix in a Nutshell (an O Reilly book). Crash Course in Unix For more info check out the Unix man pages -orhttp://www.cs.rpi.edu/~hollingd/unix -or- Unix in a Nutshell (an O Reilly book). 1 Unix Accounts To access a Unix system you need to have

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

Unix Internal Assessment-2 solution. Ans:There are two ways of starting a job in the background with the shell s & operator and the nohup command.

Unix Internal Assessment-2 solution. Ans:There are two ways of starting a job in the background with the shell s & operator and the nohup command. Unix Internal Assessment-2 solution 1 a.explain the mechanism of process creation. Ans: There are three distinct phases in the creation of a process and uses three important system calls viz., fork, exec,

More information

Introduction p. 1 Who Should Read This Book? p. 1 What You Need to Know Before Reading This Book p. 2 How This Book Is Organized p.

Introduction p. 1 Who Should Read This Book? p. 1 What You Need to Know Before Reading This Book p. 2 How This Book Is Organized p. Introduction p. 1 Who Should Read This Book? p. 1 What You Need to Know Before Reading This Book p. 2 How This Book Is Organized p. 2 Conventions Used in This Book p. 2 Introduction to UNIX p. 5 An Overview

More information

PESIT Bangalore South Campus

PESIT Bangalore South Campus INTERNAL ASSESSMENT TEST - 2 Date : 20/09/2016 Max Marks : 0 Subject & Code : Unix Shell Programming (15CS36) Section : 3 rd Sem ISE/CSE Name of faculty : Prof Ajoy Time : 11:30am to 1:00pm SOLUTIONS 1

More information

Programs. Program: Set of commands stored in a file Stored on disk Starting a program creates a process static Process: Program loaded in RAM dynamic

Programs. Program: Set of commands stored in a file Stored on disk Starting a program creates a process static Process: Program loaded in RAM dynamic Programs Program: Set of commands stored in a file Stored on disk Starting a program creates a process static Process: Program loaded in RAM dynamic Types of Processes 1. User process: Process started

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

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

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

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

CS Unix Tools. Lecture 3 Making Bash Work For You Fall Hussam Abu-Libdeh based on slides by David Slater. September 13, 2010

CS Unix Tools. Lecture 3 Making Bash Work For You Fall Hussam Abu-Libdeh based on slides by David Slater. September 13, 2010 Lecture 3 Making Bash Work For You Fall 2010 Hussam Abu-Libdeh based on slides by David Slater September 13, 2010 A little homework Homework 1 out now Due on Thursday at 11:59PM Moving around and GNU file

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

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

3/8/2017. Unix/Linux Introduction. In this part, we introduce. What does an OS do? Examples

3/8/2017. Unix/Linux Introduction. In this part, we introduce. What does an OS do? Examples EECS2301 Title Unix/Linux Introduction These slides are based on slides by Prof. Wolfgang Stuerzlinger at York University Warning: These notes are not complete, it is a Skelton that will be modified/add-to

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

Assignment clarifications

Assignment clarifications Assignment clarifications How many errors to print? at most 1 per token. Interpretation of white space in { } treat as a valid extension, involving white space characters. Assignment FAQs have been updated.

More information

CSC UNIX System, Spring 2015

CSC UNIX System, Spring 2015 CSC 352 - UNIX System, Spring 2015 Study guide for the CSC352 midterm exam (20% of grade). Dr. Dale E. Parson, http://faculty.kutztown.edu/parson We will have a midterm on March 19 on material we have

More information

Chapter 1 - Introduction. September 8, 2016

Chapter 1 - Introduction. September 8, 2016 Chapter 1 - Introduction September 8, 2016 Introduction Overview of Linux/Unix Shells Commands: built-in, aliases, program invocations, alternation and iteration Finding more information: man, info Help

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

Perl and R Scripting for Biologists

Perl and R Scripting for Biologists Perl and R Scripting for Biologists Lukas Mueller PLBR 4092 Course overview Linux basics (today) Linux advanced (Aure, next week) Why Linux? Free open source operating system based on UNIX specifications

More information

EECS 2031E. Software Tools Prof. Mokhtar Aboelaze

EECS 2031E. Software Tools Prof. Mokhtar Aboelaze EECS 2031 Software Tools Prof. Mokhtar Aboelaze Footer Text 1 EECS 2031E Instructor: Mokhtar Aboelaze Room 2026 CSEB lastname@cse.yorku.ca x40607 Office hours TTH 12:00-3:00 or by appointment 1 Grading

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

EECS2301. Lab 1 Winter 2016

EECS2301. Lab 1 Winter 2016 EECS2301 Lab 1 Winter 2016 Lab Objectives In this lab, you will be introduced to the Linux operating system. The basic commands will be presented in this lab. By the end of you alb, you will be asked to

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

UNIX Shell Programming

UNIX Shell Programming $!... 5:13 $$ and $!... 5:13.profile File... 7:4 /etc/bashrc... 10:13 /etc/profile... 10:12 /etc/profile File... 7:5 ~/.bash_login... 10:15 ~/.bash_logout... 10:18 ~/.bash_profile... 10:14 ~/.bashrc...

More information

Unix System Architecture, File System, and Shell Commands

Unix System Architecture, File System, and Shell Commands Unix System Architecture, File System, and Shell Commands Prof. (Dr.) K.R. Chowdhary, Director COE Email: kr.chowdhary@iitj.ac.in webpage: http://www.krchowdhary.com JIET College of Engineering August

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

Appendix B WORKSHOP. SYS-ED/ Computer Education Techniques, Inc.

Appendix B WORKSHOP. SYS-ED/ Computer Education Techniques, Inc. Appendix B WORKSHOP SYS-ED/ Computer Education Techniques, Inc. 1 Introduction There are no workshops for this chapter. The instructor will provide demonstrations and examples. SYS-ED/COMPUTER EDUCATION

More information

Chapter 9. Shell and Kernel

Chapter 9. Shell and Kernel Chapter 9 Linux Shell 1 Shell and Kernel Shell and desktop enviroment provide user interface 2 1 Shell Shell is a Unix term for the interactive user interface with an operating system A shell usually implies

More information

Processes. Shell Commands. a Command Line Interface accepts typed (textual) inputs and provides textual outputs. Synonyms:

Processes. Shell Commands. a Command Line Interface accepts typed (textual) inputs and provides textual outputs. Synonyms: Processes The Operating System, Shells, and Python Shell Commands a Command Line Interface accepts typed (textual) inputs and provides textual outputs. Synonyms: - Command prompt - Shell - CLI Shell commands

More information

Unix as a Platform Exercises + Solutions. Course Code: OS 01 UNXPLAT

Unix as a Platform Exercises + Solutions. Course Code: OS 01 UNXPLAT Unix as a Platform Exercises + Solutions Course Code: OS 01 UNXPLAT Working with Unix Most if not all of these will require some investigation in the man pages. That's the idea, to get them used to looking

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

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

Design Overview of the FreeBSD Kernel CIS 657

Design Overview of the FreeBSD Kernel CIS 657 Design Overview of the FreeBSD Kernel CIS 657 Organization of the Kernel Machine-independent 86% of the kernel (80% in 4.4BSD) C code Machine-dependent 14% of kernel Only 0.6% of kernel in assembler (2%

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

System Programming. Unix Shells

System Programming. Unix Shells Content : Unix shells by Dr. A. Habed School of Computer Science University of Windsor adlane@cs.uwindsor.ca http://cs.uwindsor.ca/ adlane/60-256 Content Content 1 Introduction 2 Interactive and non-interactive

More information

Introduction. Let s start with the first set of slides

Introduction. Let s start with the first set of slides Tux Wars Class - 1 Table of Contents 1) Introduction to Linux and its history 2) Booting process of a linux system 3) Linux Kernel 4) What is a shell 5) Bash Shell 6) Anatomy of command 7) Let s make our

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

ACS Unix (Winter Term, ) Page 21

ACS Unix (Winter Term, ) Page 21 ACS-294-001 Unix (Winter Term, 2016-2017) Page 21 The Shell From the beginning, Unix was designed so that the shell is an actual program separated from the main part of the operating system. What is a

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

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 AN INTRODUCTION TO SHELLS 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: understanding quotes and escapes; considering the importance of

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

elinks, mail processes nice ps, pstree, top job control, jobs, fg, bg signals, kill, killall crontab, anacron, at

elinks, mail processes nice ps, pstree, top job control, jobs, fg, bg signals, kill, killall crontab, anacron, at Processes 1 elinks, mail processes nice ps, pstree, top job control, jobs, fg, bg signals, kill, killall crontab, anacron, at 2 elinks is a text-based (character mode) web browser we will use it to enable

More information

2) clear :- It clears the terminal screen. Syntax :- clear

2) clear :- It clears the terminal screen. Syntax :- clear 1) cal :- Displays a calendar Syntax:- cal [options] [ month ] [year] cal displays a simple calendar. If arguments are not specified, the current month is displayed. In addition to cal, the ncal command

More information

Processes. System tasks Campus-Booster ID : **XXXXX. Copyright SUPINFO. All rights reserved

Processes. System tasks Campus-Booster ID : **XXXXX.  Copyright SUPINFO. All rights reserved Processes System tasks Campus-Booster ID : **XXXXX www.supinfo.com Copyright SUPINFO. All rights reserved Processes Your trainer Presenter s Name Title: **Enter title or job role. Accomplishments: **What

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

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

(MCQZ-CS604 Operating Systems)

(MCQZ-CS604 Operating Systems) command to resume the execution of a suspended job in the foreground fg (Page 68) bg jobs kill commands in Linux is used to copy file is cp (Page 30) mv mkdir The process id returned to the child process

More information

Design Overview of the FreeBSD Kernel. Organization of the Kernel. What Code is Machine Independent?

Design Overview of the FreeBSD Kernel. Organization of the Kernel. What Code is Machine Independent? Design Overview of the FreeBSD Kernel CIS 657 Organization of the Kernel Machine-independent 86% of the kernel (80% in 4.4BSD) C C code Machine-dependent 14% of kernel Only 0.6% of kernel in assembler

More information

COMS 6100 Class Notes 3

COMS 6100 Class Notes 3 COMS 6100 Class Notes 3 Daniel Solus September 1, 2016 1 General Remarks The class was split into two main sections. We finished our introduction to Linux commands by reviewing Linux commands I and II

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

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

22-Sep CSCI 2132 Software Development Lecture 8: Shells, Processes, and Job Control. Faculty of Computer Science, Dalhousie University

22-Sep CSCI 2132 Software Development Lecture 8: Shells, Processes, and Job Control. Faculty of Computer Science, Dalhousie University Lecture 8 p.1 Faculty of Computer Science, Dalhousie University CSCI 2132 Software Development Lecture 8: Shells, Processes, and Job Control 22-Sep-2017 Location: Goldberg CS 127 Time: 14:35 15:25 Instructor:

More information

File permission u owner of file/directory (user) g group of the file/directory o other a all

File permission u owner of file/directory (user) g group of the file/directory o other a all File permission u owner of file/directory (user) g group of the file/directory o other a all Permission Types: permission octal value Meaning Read (r) 4 The file can is read only, for directory it's contain

More information

CSE 390a Lecture 2. Exploring Shell Commands, Streams, Redirection, and Processes

CSE 390a Lecture 2. Exploring Shell Commands, Streams, Redirection, and Processes CSE 390a Lecture 2 Exploring Shell Commands, Streams, Redirection, and Processes slides created by Marty Stepp, modified by Jessica Miller & Ruth Anderson http://www.cs.washington.edu/390a/ 1 2 Lecture

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

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

Linux System Administration

Linux System Administration System Processes Objective At the conclusion of this module, the student will be able to: Describe and define a process Identify a process ID, the parent process and the child process Learn the PID for

More information

More Scripting and Regular Expressions. Todd Kelley CST8207 Todd Kelley 1

More Scripting and Regular Expressions. Todd Kelley CST8207 Todd Kelley 1 More Scripting and Regular Expressions Todd Kelley kelleyt@algonquincollege.com CST8207 Todd Kelley 1 Regular Expression Summary Regular Expression Examples Shell Scripting 2 Do not confuse filename globbing

More information

Lecture 3 Tonight we dine in shell. Hands-On Unix System Administration DeCal

Lecture 3 Tonight we dine in shell. Hands-On Unix System Administration DeCal Lecture 3 Tonight we dine in shell Hands-On Unix System Administration DeCal 2012-09-17 Review $1, $2,...; $@, $*, $#, $0, $? environment variables env, export $HOME, $PATH $PS1=n\[\e[0;31m\]\u\[\e[m\]@\[\e[1;34m\]\w

More information

Introduction to UNIX Part II

Introduction to UNIX Part II T H E U N I V E R S I T Y of T E X A S H E A L T H S C I E N C E C E N T E R A T H O U S T O N S C H O O L of H E A L T H I N F O R M A T I O N S C I E N C E S Introduction to UNIX Part II For students

More information

Advanced training. Linux components Command shell. LiLux a.s.b.l.

Advanced training. Linux components Command shell. LiLux a.s.b.l. Advanced training Linux components Command shell LiLux a.s.b.l. alexw@linux.lu Kernel Interface between devices and hardware Monolithic kernel Micro kernel Supports dynamics loading of modules Support

More information

EECS 470 Lab 5. Linux Shell Scripting. Friday, 1 st February, 2018

EECS 470 Lab 5. Linux Shell Scripting. Friday, 1 st February, 2018 EECS 470 Lab 5 Linux Shell Scripting Department of Electrical Engineering and Computer Science College of Engineering University of Michigan Friday, 1 st February, 2018 (University of Michigan) Lab 5:

More information

Shells and Processes. Bryce Boe 2012/08/08 CS32, Summer 2012 B

Shells and Processes. Bryce Boe 2012/08/08 CS32, Summer 2012 B Shells and Processes Bryce Boe 2012/08/08 CS32, Summer 2012 B Outline Opera>ng Systems and Linux Review Shells Project 1 Part 1 Overview Processes Overview for Monday (Sor>ng Presenta>ons) OS Review Opera>ng

More information