Table of Contents. Evaluation Copy

Size: px
Start display at page:

Download "Table of Contents. Evaluation Copy"

Transcription

1 Table of Contents Perspective grep sort head and tail tr cut od paste split uniq sed gawk more and less tee lp CHAPTER 2: BASH SHELL PROGRAMMING Shells Scripting Rationale Scripting Prerequisites Creating a bash Script bash Startup Scripts A Script s Environment Exporting Variables Exit Status Programming the bash Shell Parameter Passing Operators Decision Making - if Complex Decisions Arithmetic Looping Constructs - for Input and Output - echo and read Looping Constructs - while Functions Interrupts CHAPTER 3: BASH SHELL ARITHMETIC Introduction expr bash Arithmetic Typed Variables v

2 Arrays CHAPTER 4: NETWORKING TOOLS TCP/IP IP Addresses Network Configuration Files Client / Server Computing telnet ping ftp Non-Interactive ftp ssh scp CHAPTER 5: ADMINISTRATIVE TOOLS date adduser chown sudo df du gzip and gunzip tar at crontab yum CHAPTER 6: SOFTWARE TOOLS Building a Linux Utility Creating a Utility The C Compiler make Libraries Shared Libraries APPENDIX A: THE VISUAL (VI) EDITOR vi Modes...A-2 Starting and Stopping vi...a-3 Last Line Mode Commands...A-4 Cursor Movement Commands...A-5 Delete and Search Commands...A-6 vi

3 Chapter 1: Linux Filters 1) Perspective ) grep ) sort ) head and tail ) tr ) cut ) od ) paste ) split ) uniq ) sed ) gawk ) more and less ) tee ) lp

4 Perspective Good software engineering has always been a trademark of any UNIX system. One of the original UNIX philosophies, present in any Linux system, was to provide a large set of software tools (i.e., component utilities), each of which: is well written does one thing does it efficiently To perform simple tasks on the system, use the appropriate tool. To perform complex tasks on the system, use appropriate tools and combine them properly. pipes scripts This strategy works best if each command is able to read the standard input and also write its output to the standard output. Such commands on UNIX and Linux systems are referred to as filters. This section presents the most commonly used Linux filters. 1-2

5 grep The most heralded Linux command is grep, a patternmatching utility used to display lines of a file that match a pattern. The pattern is given as the first argument. The files to be searched are given as subsequent arguments. If no files are given on the command line, grep reads the standard input. A few simple examples display lines from /etc/passwd that match a pattern. $ grep root /etc/passwd root:x:0:0:root:/root:/bin/bash operator:x:11:0:operator:/root:/sbin/nologin $ echo $LOGNAME michael $ grep $LOGNAME /etc/passwd michael:x:527:527::/home/michael:/bin/bash grep supports many useful options. Some of them are listed here. -n displays line numbers -c displays a count of lines -i ignores case -l lists file names containing match -v displays unmatched lines 1-3

6 grep $ grep n root /etc/passwd 1:root:x:0:0:root:/root:/bin/bash 12:operator:x:11:0:/root:/sbin/nologin $ echo $LOGNAME michael $ grep n $LOGNAME /etc/passwd 64:michael:x:527:527::/home/michael:/bin/bash $ wc l /etc/passwd 67 /etc/passwd $ grep c /bin/bash /etc/passwd 35 $ grep cv /bin/bash /etc/passwd 32 $ su root Password: # grep l initdefault /etc/* /etc/inittab # exit 1-4

7 grep In addition to simple patterns, grep also allows the use of patterns containing meta-characters - i.e., characters that have special meanings. Since some of these special characters are also special to the shell, they are typically quoted to prevent the shell from expanding them.. match any character $ match at end of line ^ match at beginning of line \ turn off special meaning [ ] alternatives * zero or more of the preceding character Examples: $ grep '^the' file1 # beginning w/ the $ grep 'mike$' file1 # ending w/ mike $ grep '^the$' file1 # containing just the $ grep '\.$' file1 # ending with a period # lines containing a five-letter pattern # beginning with th and ending with e $ grep 'th..e' file1 # lines beginning with at least one digit and # followed by an upper case character $ grep '^[0-9][0-9]*[A-Z]' file1 1-5

8 grep Suppose that you need to find lines in a file containing a phrase. You must quote the pattern so that it will be parsed by the shell as the first argument. $ grep Run xdm /etc/inittab grep: xdm: No such file or directory /etc/inittab:# Run gettys in standard run levels /etc/intttab:# Run xdm in runlevel 5 $ grep "Run xdm" /etc/inittab # Run xdm in runlevel 5 Once you are thoroughly familiar with filters, you will begin to see how useful they are when used in pipelines. Here is a simple example using grep. $ date grep Thu # Thursday? Thu Dec 21 08:07:12 EST 2008 # Yes $ date grep Tue # Tuesday? # No Commands such as those in the previous session can be used in scripts to conditionally control a process. Here is a preview. while date grep Thu do date >> users-log who >> users-log sleep 60 done # If Thursday # date/time # who is logged in # one minute pause 1-6

9 sort sort sorts lines from text files named on the command line or in their absence sorts the standard input. By default, the entire line is used as the key. The examples will use the file named data (in your datafiles directory). $ cat data Michael Saltzman 58 Instructor Patti Ordonez 35 Instructor David Flanagan 37 Instructor Susan Saltzman 41 President Susan Doddridge 40 Technical Robert Knox 61 Sales Tom Vielandi 46 Sales Alan Baumgarten 52 Instructor Maria Gonzales 46 Coordinator Jason Pearlman 22 Instructor Erin Flanagan 29 Administrator Below is a simple example. $ sort data Alan Baumgarten 52 Instructor David Flanagan 37 Instructor Erin Flanagan 29 Administrator Jason Pearlman 22 Instructor Maria Gonzales 46 Coordinator Michael Saltzman 58 Instructor Patti Ordonez 35 Instructor Robert Knox 61 Sales Susan Doddridge 40 Technical Susan Saltzman 41 President Tom Vielandi 46 Sales 1-7

10 sort Various options control the behavior of sort. For example, to sort the data using the second field (and the rest of the line) as the key, use the following. $ sort -k2 data Alan Baumgarten 52 Instructor Susan Doddridge 40 Technical Erin Flanagan 29 Administrator David Flanagan 37 Instructor Maria Gonzales 46 Coordinator Robert Knox 61 Sales Patti Ordonez 35 Instructor Jason Pearlman 22 Instructor Susan Saltzman 41 President Michael Saltzman 58 Instructor Tom Vielandi 46 Sales To sort numerically, say on the third field, use the following. $ sort -nk3 data Jason Pearlman 22 Instructor Erin Flanagan 29 Administrator Patti Ordonez 35 Instructor David Flanagan 37 Instructor Susan Doddridge 40 Technical Susan Saltzman 41 President Maria Gonzales 46 Coordinator Tom Vielandi 46 Sales Alan Baumgarten 52 Instructor Michael Saltzman 58 Instructor Robert Knox 61 Sales Reverse sorts are accomplished with the r option. $ sort -rk2 data $ sort -rnk3 data 1-8

11 sort There is always the chance that there may be "ties" when you are sorting. These ties are normally settled by using the entire line as a "secondary key." However, you can explicitly specify a secondary key as follows. $ sort -k2,2 -k4,4 data Alan Baumgarten 52 Instructor Susan Doddridge 40 Technical Erin Flanagan 29 Administrator David Flanagan 37 Instructor Maria Gonzales 46 Coordinator Robert Knox 61 Sales Patti Ordonez 35 Instructor Jason Pearlman 22 Instructor Michael Saltzman 58 Instructor Susan Saltzman 41 President Tom Vielandi 46 Sales Other useful options to the sort are shown below. -f ignores case -t separates fields -o names the output file To do a reverse sort on the UID field of /etc/passwd: $ sort t: -nrk3 /etc/passwd To perform an "in place" sort: $ sort o data data Sort is often used in pipelines. Shown below is a common idiom. $ ls l /bin sort -nk5 1-9

12 head and tail The head command displays the first ten lines of a file. The exact number of lines is controlled by the first argument. $ head 4 data Michael Saltzman 58 Instructor Patti Ordonez 35 Instructor David Flanagan 37 Instructor Susan Saltzman 41 President The tail command displays the last ten lines of a file. The exact number of lines is controlled by the first argument. $ tail 4 data Alan Baumgarten 52 Instructor Maria Gonzales 46 Coordinator Jason Pearlman 22 Instructor Erin Flanagan 29 Administrator tail has a very useful option that produces all the lines of a file beginning with a particular line. $ tail -n +10 data Jason Pearlman 22 Instructor Erin Flanagan 29 Administrator Another useful feature of tail is to output data to a file as the file grows. This is useful when you are monitoring log files. $ tail f logfile 1-10

13 tr tr is used to translate one set of characters to another or to delete a set of characters. Input must come from the standard input rather than from files named as command line arguments. $ head 2 data tr aeiou AEIOU MIchAEl SAltzmAn 58 InstrUctOr PAttI OrdOnEz 35 InstrUctOr Some sets are more common than others are. Therefore, tr allows special notations in expressing these sets. These special notations should be quoted to prevent possible shell expansion. [0-9] digits [a-z] lower case characters [A-Z] upper case characters [a-za-z] alphabetic characters To translate to upper case: $ head 2 data tr '[a-z]' '[A-Z]' MICHAEL SALTZMAN 58 INSTRUCTOR PATTI ORDONEZ 35 INSTRUCTOR tr is commonly used in a pipeline to perform a small editing job. For example, suppose you wish to display the PATH directories, with one directory name per line. Compare the output for the following two command lines. $ echo $PATH $ echo $PATH tr : '\n' 1-11

14 tr The most commonly used options are shown below. -d deletes this set of characters -s replaces a sequence of characters with one -c complements of a character set To delete certain characters (say digits): $ head 2 data tr -d '[0-9]' Michael Saltzman Instructor Patti Ordonez Instructor To squeeze certain characters (say s and p ): $ echo mississippi tr -s sp misisipi A common use of tr is to determine the words (tokens) of a file. The strategy is to take each character that is not alphabetic and replace it with a newline, and then squeeze the newlines. The following tr idiom does the job. $ head 1 data tr cs '[a-za-z]' '\n' Michael Saltzman Instructor 1-12

15 cut cut reads the standard input or files named on the command line and displays specified characters or fields. c for files whose fields are fixed length -f for files whose fields are variable length The fields or characters to display are denoted by lists whose formats are specified as follows. List Meaning 3 3 3,10,12 3 and 10 and through through the rest of the line -3 1, 2 and 3 Examples: $ head 3 data cut -c1-10 Michael Sa Patti Ordo David Flan $ date cut -c1-3 Fri $ DAY=`date cut -c1-3` $ echo $DAY Fri $ alias day=`date cut -c1-3` $ day Fri 1-13

16 cut cut assumes that the field separator is the tab character. If this is not the case, then you must use the d option to specify the field separator. For example, if you wanted to display only the first (login name) field of /etc/passwd, you would use: $ cut -d: -f1 /etc/passwd head -3 root bin daemon You might wish to display the first and last fields of the file named data. Since that file had a single blank character separating its fields, you would use: $ head 3 data cut -d' ' f1,4 Michael Instructor Patti Instructor David Instructor Note carefully how the blank character had to be protected from shell expansion. 1-14

17 od od is the octal dump command. It provides different views of a file. Suppose there is a file named mydata. $ cat mydata A b 0 1 X $ wc mydata mydata The wc command reports that there are 10 characters in the mydata file. Here are some examples of od to display the characters reported by wc. $ od -a mydata # character A sp b ht 0 sp 1 ht X nl $ od -x mydata # hex a58 $ od -b mydata # octal $ od -cb mydata A b \t 0 1 \t X \n

18 paste paste pastes lines from separate files together as a single file. The tab character is the default field separator in the resultant file. Commonly used options are: -d specify your own separator -s paste one file at a time - file is standard input Examples: $ cat users usera userb $ cat ids $ paste users ids usera 101 userb 102 $ paste d' ' users ids usera 101 userb 102 $ paste s users ids usera userb $ ls file1 file2 file3 file4 file5 file6 ids users $ ls paste -d' ' file1 file2 file3 file4 file5 file6 ids users 1-16

19 split split splits large files into smaller ones. This is useful for treating parts of a file as solo entities. The resultant files are 1000 lines by default. $ wc -l bigfile 2760 bigfile $ split bigfile $ wc -l xaa xab xac 1000 xaa 1000 xab 760 xac 2760 total You can use arguments to determine the size and the names of the output files. $ split -500 bigfile myname $ wc -l myname* 500 mynameaa 500 mynameab 500 mynameac 500 mynamead 500 mynameae 260 mynameaf 2760 total 1-17

20 uniq uniq reports duplicate adjacent lines. One of each set of adjacent identical lines is sent to the standard output. Commonly used options are: -u one copy of the unique lines -d one copy of adjacent identical lines -c counts occurrences of adjacent identical lines Examples: $ cat uniqdata this this this sample sample data this this $ uniq uniqdata this sample data this $ uniq d uniqdata this sample this $ uniq u uniqdata data $ uniq -c uniqdata 3 this 2 sample 1 data 2 this 1-18

21 sed sed is the stream editor. Each of the lines read by sed is sent to the standard output, possibly edited. Below are several simple sed commands. $ sed 1d file1 # delete line 1 $ sed '$d' file1 # delete last line $ sed e 1d e '$d' file1 # delete first and # last lines $ sed 's/hi/aloha/g' file1 # global substitution # of aloha for hi $ sed '/mike/d' file1 # delete all lines # matching mike $ sed '/mike/!d' file1 # delete all lines # not matching mike When sed commands become complex, you may place them in a file and instruct sed to read from that file. $ sed f sedcmds datafile(s) 1-19

22 sed sed uses some special characters so that editing tasks are made easier. The dot character (.) matches any single character. The asterisk character (*) matches one or more of the characters to its left. Therefore, the combination of.* means "as many characters as possible." In particular, you can surround them with other characters such as: 'A.*B' '.* ' # A anything B # blank anything blank Below are some examples: Strip the day from the date command. $ date Wed Sep 21 11:30:29 EDT 2008 $ date sed 's/... //' Sep 21 11:30:29 EDT 2008 Strip extra output from the id command. $ id uid=501(mike) gid=501(mike) groups=501(mike) $ id sed 's/.*//' uid=501(mike) 1-20

23 gawk awk is a pattern scanning and small data base retrieval language written in the mid 1970s by Alfred Aho, Peter Weinberger, and Brian Kernighan. It has been revised several times and now runs under the name of gawk. Despite its complexity, gawk can be simple enough to be used as a command line utility. The basic strategy is to: process one line at a time from its input apply one (or more) gawk commands to each input line. gawk has several built-in variables. NR record number NF number of fields on the input line $0 input line $1 first field of the input line $2 second field $3 third field, etc. gawk allows any number of spaces and/or tabs as field delimiters. In the examples that follow, we will use the previously seen data file as the input file. 1-21

24 gawk $ gawk '{print NR, $0}' data 1 Michael Saltzman 58 Instructor 2 Patti Ordonez 35 Instructor 3 David Flanagan 37 Instructor 4 Susan Saltzman 41 President 5 Susan Doddridge 40 Technical 6 Robert Knox 61 Sales 7 Tom Vielandi 46 Sales 8 Alan Baumgarten 52 Instructor 9 Maria Gonzales 46 Coordinator 10 Jason Pearlman 22 Instructor 11 Erin Flanagan 29 Administrator $ gawk '{print $2, $4}' data Saltzman Instructor Ordonez Instructor Flanagan Instructor Saltzman President Doddridge Technical Knox Sales Vielandi Sales Baumgarten Instructor Gonzales Coordinator Pearlman Instructor Flanagan Administrator 1-22

25 gawk You can print text as well as data. Simply enclose the text inside double quotes. $ head 2 data gawk '{print $1, "is", $3}' Michael is 58 Patti is 35 Each gawk command actually has the following form. 'condition { action }' If the action is omitted, input lines are printed if the condition is true. If the condition is omitted, the action occurs for all lines. Here is a list of selected conditions: pattern /pattern/ built-in function length($0) relational condition $3 > 30 $3 > 30 && $3 <

26 gawk Examples Relational conditional $ gawk '$3 > 50 {print $1,$2,$4}' data Michael Saltzman Instructor Robert Knox Sales Alan Baumgarten Instructor Using a function $ gawk 'length($1) < 5' data Tom Vielandi 46 Sales Alan Baumgarten 52 Instructor Erin Flanagan 29 Administrator Pattern matching $ gawk '$4 ~ /Ins/' data Michael Saltzman 58 Instructor Patti Ordonez 35 Instructor David Flanagan 37 Instructor Alan Baumgarten 52 Instructor Jason Pearlman 22 Instructor If the field separator is anything other than spaces or tabs, then the F option must be used. $ gawk -F: '$3 < 100 {print $1}' /etc/passwd gawk programs can be arbitrarily complex. Rather than writing long command lines, you can place gawk commands into a file and execute them as shown here. $ gawk -f file_of_awk_commands inputfile(s) 1-24

27 more and less more and less are two utilities that allow you to display a file one page at a time. Each command displays the first page of the file and then awaits instructions. Instructions are given in the form of commands that allow for searching, scrolling, and jumping to various places within the file. less is the more recent of the two and therefore has more functionality. Each is typically used: to scroll through a file one page at a time $ more /etc/profile $ ps -A less as the last command in a sequence of piped commands. $ find. more $ ls -l /usr/bin less When you start either command, you can get help by pressing the 'h' key. 1-25

28 tee tee takes its input and does the following. sends it to a file sends it to the standard output When you have a long sequence of commands in a pipeline, you only see the results of the last command in the pipeline. $ tr cs '[a-za-z]' '\n' < input sort uniq c If you wish to capture intermediate results, use the tee command. $ tr cs '[a-za-z]' '\n' < input sort > tee save uniq c In the above example, the file named save would contain all of the processing up to and including the output from sort. You can use the tee command at each stage in the pipe sequence. $ tr cs '[a-za-z]' '\n' < input sort > tee save uniq c tee savewords sort -n In the above sequence, the intermediate processing has been saved: after the sorting after the counting 1-26

29 lp To prevent simultaneous printing by more than one user, Linux uses a client/server printing system. The printer daemon, cupsd, is typically started when your system is booted. It then waits for jobs to be printed. Users use the lp command to send jobs to a well-known spooling directory. Each job is given an identification string consisting of the printer name and a number. $ lp testfile request id is myprinter-154 $ lp thisfile thatfile request id is myprinter-156 (2 files) Many Linux systems have more than one printer. Each printer is given a symbolic name by the system administrator when the printer system is configured. Users can specify the particular printer with the -d option. $ lp -d printername file1 file2 The lpq command gives the status of various printer queues. 1-27

30 Exercises 1. Use the head and tail commands together in a pipeline to produce only lines 5 through 10 from the input data. (Hint: Recall n +NUMBER option to the tail command.) Use cat n /etc/profile to generate the data. 2. The ls a command lists those files that begin with a dot in addition to all other files. Use this idea along with a grep command to list only the files that begin with a dot in your home directory. (Note that Linux provides the 'l.' alias.) 3. How can you tell if the white space between the ls l output fields are blanks or tabs? (Hint: od) 4. Use tr to squeeze these white space characters from an ls l listing, and then use cut to display only the sizes and filenames. 5. Write a command that lists the sizes and names of the ordinary files in the /bin directory in descending order by size. Ordinary files will have a dash in the first column of the ls l output. 6. Use tr, sort, uniq, and head to list the five most frequently used words in a file and their corresponding frequency. (Do not worry about ties.) 7. In the previous example, use tee to save the output before the final five words are displayed. 1-28

31 Exercises 8. List the filename and owner of the files in the /bin directory which have the permission 755 and whose size is greater than 500,000 bytes. (Hint: You will need gawk here.) 9. Use the output of the id command along with sed to display just the uid number. This will require more than one sed command. 10. The file named fourlines (in the datafiles directory) has four-line "records." Write as many commands as you need in order to sort this file on last names. (Hint: Consider splitting the file into four line files and then pasting together lines from the same file. Now you can use the sort utility). This is a hard problem! 11. Sort the mdzips file (in the datafiles directory) in order by city name (rather than by zipcode). 12. Write commands to perform each of the following actions on the people file (in the datafiles directory). Hint: use grep, gawk, cut, and/or sed. Print all lines that contain "Street" Print all lines where the first name begins with "B" Print all lines where the last name begins with "Ker" Print lines 2 through 4 Print phone numbers that are in the 408 area code Print Lori Gortz's name and address Print Ephram's first and last name in capital letters Print lines that do NOT contain a "4" 1-29

32 Exercises Exercise 12 (continued) Print the line containing Wilhelm Kopf, changing Wilhelm to William Print Tommy's birthday (without the year) Print lines where the last field is exactly 5 digits Print the names of all persons born in March 1-30

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

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

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

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

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

Unix as a Platform Exercises. Course Code: OS-01-UNXPLAT Unix as a Platform Exercises Course Code: OS-01-UNXPLAT Working with Unix 1. Use the on-line manual page to determine the option for cat, which causes nonprintable characters to be displayed. Run the command

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

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

Using bash. Administrative Shell Scripting COMP2101 Fall 2017

Using bash. Administrative Shell Scripting COMP2101 Fall 2017 Using bash Administrative Shell Scripting COMP2101 Fall 2017 Bash Background Bash was written to replace the Bourne shell The Bourne shell (sh) was not a good candidate for rewrite, so bash was a completely

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

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

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

D. Delete the /var/lib/slocate/slocate.db file because it buffers all search results.

D. Delete the /var/lib/slocate/slocate.db file because it buffers all search results. Volume: 230 Questions Question No: 1 You located a file created in /home successfully by using the slocate command. You found that the slocate command could locate that file even after deletion. What could

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 Shell Scripting. Linux System Administration COMP2018 Summer 2017

Linux Shell Scripting. Linux System Administration COMP2018 Summer 2017 Linux Shell Scripting Linux System Administration COMP2018 Summer 2017 What is Scripting? Commands can be given to a computer by entering them into a command interpreter program, commonly called a shell

More information

Contents. xxvii. Preface

Contents. xxvii. Preface Preface xxvii Chapter 1: Welcome to Linux 1 The GNU Linux Connection 2 The History of GNU Linux 2 The Code Is Free 4 Have Fun! 5 The Heritage of Linux: UNIX 5 What Is So Good About Linux? 6 Why Linux Is

More information

Lecture #13 AWK Part I (Chapter 6)

Lecture #13 AWK Part I (Chapter 6) CS390 UNIX Programming Spring 2009 Page 1 Lecture #13 AWK Part I (Chapter 6) Background AWK is a pattern-scanning and processing language. Named after authors (Alfred Aho, Peter Weinberger, Brian Kernighan).

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

Linux Text Utilities 101 for S/390 Wizards SHARE Session 9220/5522

Linux Text Utilities 101 for S/390 Wizards SHARE Session 9220/5522 Linux Text Utilities 101 for S/390 Wizards SHARE Session 9220/5522 Scott D. Courtney Senior Engineer, Sine Nomine Associates March 7, 2002 http://www.sinenomine.net/ Table of Contents Concepts of the Linux

More information

COL100 Lab 2. I semester Week 2, Open the web-browser and visit the page and visit the COL100 course page.

COL100 Lab 2. I semester Week 2, Open the web-browser and visit the page   and visit the COL100 course page. COL100 Lab 2 I semester 2017-18 Week 2, 2017 Objective More familiarisation with Linux and its standard commands Part 1 1. Login to your system and open a terminal window. 2. Open the web-browser and visit

More information

Introduction To Linux. Rob Thomas - ACRC

Introduction To Linux. Rob Thomas - ACRC Introduction To Linux Rob Thomas - ACRC What Is Linux A free Operating System based on UNIX (TM) An operating system originating at Bell Labs. circa 1969 in the USA More of this later... Why Linux? Free

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

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

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

UNIX files searching, and other interrogation techniques

UNIX files searching, and other interrogation techniques UNIX files searching, and other interrogation techniques Ways to examine the contents of files. How to find files when you don't know how their exact location. Ways of searching files for text patterns.

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

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 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

UNIX II:grep, awk, sed. October 30, 2017

UNIX II:grep, awk, sed. October 30, 2017 UNIX II:grep, awk, sed October 30, 2017 File searching and manipulation In many cases, you might have a file in which you need to find specific entries (want to find each case of NaN in your datafile for

More information

CS160A EXERCISES-FILTERS2 Boyd

CS160A EXERCISES-FILTERS2 Boyd Exercises-Filters2 In this exercise we will practice with the Unix filters cut, and tr. We will also practice using paste, even though, strictly speaking, it is not a filter. In addition, we will expand

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

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

Fall 2006 Shell programming, part 3. touch

Fall 2006 Shell programming, part 3. touch touch Touch is usually a program, but it can be a shell built-in such as with busybox. The touch program by default changes the access and modification times for the files listed as arguments. If the file

More information

The input can also be taken from a file and similarly the output can be redirected to another file.

The input can also be taken from a file and similarly the output can be redirected to another file. Filter A filter is defined as a special program, which takes input from standard input device and sends output to standard output device. The input can also be taken from a file and similarly the output

More information

Overview. Unix/Regex Lab. 1. Setup & Unix review. 2. Count words in a text. 3. Sort a list of words in various ways. 4.

Overview. Unix/Regex Lab. 1. Setup & Unix review. 2. Count words in a text. 3. Sort a list of words in various ways. 4. Overview Unix/Regex Lab CS 341: Natural Language Processing Heather Pon-Barry 1. Setup & Unix review 2. Count words in a text 3. Sort a list of words in various ways 4. Search with grep Based on Unix For

More information

- c list The list specifies character positions.

- c list The list specifies character positions. CUT(1) BSD General Commands Manual CUT(1)... 1 PASTE(1) BSD General Commands Manual PASTE(1)... 3 UNIQ(1) BSD General Commands Manual UNIQ(1)... 5 HEAD(1) BSD General Commands Manual HEAD(1)... 7 TAIL(1)

More information

Awk & Regular Expressions

Awk & Regular Expressions Awk & Regular Expressions CSCI-620 Dr. Bill Mihajlovic awk Text Editor awk, named after its developers Aho, Weinberger, and Kernighan. awk is UNIX utility. The awk command uses awk program to scan text

More information

http://xkcd.com/208/ 1. Review of pipes 2. Regular expressions 3. sed 4. awk 5. Editing Files 6. Shell loops 7. Shell scripts cat seqs.fa >0! TGCAGGTATATCTATTAGCAGGTTTAATTTTGCCTGCACTTGGTTGGGTACATTATTTTAAGTGTATTTGACAAG!

More information

Lecture 5. Essential skills for bioinformatics: Unix/Linux

Lecture 5. Essential skills for bioinformatics: Unix/Linux Lecture 5 Essential skills for bioinformatics: Unix/Linux UNIX DATA TOOLS Text processing with awk We have illustrated two ways awk can come in handy: Filtering data using rules that can combine regular

More information

CS214-AdvancedUNIX. Lecture 2 Basic commands and regular expressions. Ymir Vigfusson. CS214 p.1

CS214-AdvancedUNIX. Lecture 2 Basic commands and regular expressions. Ymir Vigfusson. CS214 p.1 CS214-AdvancedUNIX Lecture 2 Basic commands and regular expressions Ymir Vigfusson CS214 p.1 Shellexpansions Let us first consider regular expressions that arise when using the shell (shell expansions).

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

CSE 303 Lecture 2. Introduction to bash shell. read Linux Pocket Guide pp , 58-59, 60, 65-70, 71-72, 77-80

CSE 303 Lecture 2. Introduction to bash shell. read Linux Pocket Guide pp , 58-59, 60, 65-70, 71-72, 77-80 CSE 303 Lecture 2 Introduction to bash shell read Linux Pocket Guide pp. 37-46, 58-59, 60, 65-70, 71-72, 77-80 slides created by Marty Stepp http://www.cs.washington.edu/303/ 1 Unix file system structure

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

List of Linux Commands in an IPm

List of Linux Commands in an IPm List of Linux Commands in an IPm Directory structure for Executables bin: ash cpio false ln mount rm tar zcat busybox date getopt login mv rmdir touch cat dd grep ls perl sed true chgrp df gunzip mkdir

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/Linux Primer. Taras V. Pogorelov and Mike Hallock School of Chemical Sciences, University of Illinois

Unix/Linux Primer. Taras V. Pogorelov and Mike Hallock School of Chemical Sciences, University of Illinois Unix/Linux Primer Taras V. Pogorelov and Mike Hallock School of Chemical Sciences, University of Illinois August 25, 2017 This primer is designed to introduce basic UNIX/Linux concepts and commands. No

More information

Mastering Linux. Paul S. Wang. CRC Press. Taylor & Francis Group. Taylor & Francis Croup an informa business. A CHAPMAN St HALL BOOK

Mastering Linux. Paul S. Wang. CRC Press. Taylor & Francis Group. Taylor & Francis Croup an informa business. A CHAPMAN St HALL BOOK Mastering Linux Paul S. Wang CRC Press Taylor & Francis Group Boca Raton London New York CRC Press is an Imprint of the Taylor & Francis Croup an informa business A CHAPMAN St HALL BOOK Contents Preface

More information

Practical 02. Bash & shell scripting

Practical 02. Bash & shell scripting Practical 02 Bash & shell scripting 1 imac lab login: maclab password: 10khem 1.use the Finder to visually browse the file system (single click opens) 2.find the /Applications folder 3.open the Utilities

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

IB047. Unix Text Tools. Pavel Rychlý Mar 3.

IB047. Unix Text Tools. Pavel Rychlý Mar 3. Unix Text Tools pary@fi.muni.cz 2014 Mar 3 Unix Text Tools Tradition Unix has tools for text processing from the very beginning (1970s) Small, simple tools, each tool doing only one operation Pipe (pipeline):

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

Chapter 4. Unix Tutorial. Unix Shell

Chapter 4. Unix Tutorial. Unix Shell Chapter 4 Unix Tutorial Users and applications interact with hardware through an operating system (OS). Unix is a very basic operating system in that it has just the essentials. Many operating systems,

More information

CS 124/LINGUIST 180 From Languages to Information. Unix for Poets Dan Jurafsky

CS 124/LINGUIST 180 From Languages to Information. Unix for Poets Dan Jurafsky CS 124/LINGUIST 180 From Languages to Information Unix for Poets Dan Jurafsky (original by Ken Church, modifications by me and Chris Manning) Stanford University Unix for Poets Text is everywhere The Web

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

Where can UNIX be used? Getting to the terminal. Where are you? most important/useful commands & examples. Real Unix computers

Where can UNIX be used? Getting to the terminal. Where are you? most important/useful commands & examples. Real Unix computers Where can UNIX be used? Introduction to Unix: most important/useful commands & examples Bingbing Yuan Jan. 19, 2010 Real Unix computers tak, the Whitehead h Scientific Linux server Apply for an account

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

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

Unix Scripts and Job Scheduling. Overview. Running a Shell Script

Unix Scripts and Job Scheduling. Overview. Running a Shell Script Unix Scripts and Job Scheduling Michael B. Spring Department of Information Science and Telecommunications University of Pittsburgh spring@imap.pitt.edu http://www.sis.pitt.edu/~spring Overview Shell Scripts

More information

Linux Essentials Objectives Topics:

Linux Essentials Objectives Topics: Linux Essentials Linux Essentials is a professional development certificate program that covers basic knowledge for those working and studying Open Source and various distributions of Linux. Exam Objectives

More information

LINUX FUNDAMENTALS. Supported Distributions: Red Hat Enterprise Linux 6 SUSE Linux Enterprise 11 Ubuntu LTS. Recommended Class Length: 5 days

LINUX FUNDAMENTALS. Supported Distributions: Red Hat Enterprise Linux 6 SUSE Linux Enterprise 11 Ubuntu LTS. Recommended Class Length: 5 days LINUX FUNDAMENTALS The course is a challenging course that focuses on the fundamental tools and concepts of Linux and Unix. Students gain proficiency using the command line. Beginners develop a solid foundation

More information

Prerequisites: Students should be comfortable with computers. No familiarity with Linux or other Unix operating systems is required.

Prerequisites: Students should be comfortable with computers. No familiarity with Linux or other Unix operating systems is required. GL-120: Linux Fundamentals Course Length: 4 days Course Description: The GL120 is a challenging course that focuses on the fundamental tools and concepts of Linux and Unix. Students gain proficiency using

More information

Linux Fundamentals (L-120)

Linux Fundamentals (L-120) Linux Fundamentals (L-120) Modality: Virtual Classroom Duration: 5 Days SUBSCRIPTION: Master, Master Plus About this course: This is a challenging course that focuses on the fundamental tools and concepts

More information

ADVANCED LINUX SYSTEM ADMINISTRATION

ADVANCED LINUX SYSTEM ADMINISTRATION Lab Assignment 1 Corresponding to Topic 2, The Command Line L1 Main goals To get used to the command line. To gain basic skills with the system shell. To understand some of the basic tools of system administration.

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

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

Wildcards and Regular Expressions

Wildcards and Regular Expressions CSCI 2132: Software Development Wildcards and Regular Expressions Norbert Zeh Faculty of Computer Science Dalhousie University Winter 2019 Searching Problem: Find all files whose names match a certain

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

Provides ability to perform UNIX commands at some time in the future. At time time on day day, the commands in filefile will be executed.

Provides ability to perform UNIX commands at some time in the future. At time time on day day, the commands in filefile will be executed. Some UNIX Commands at at time [day] [file] Provides ability to perform UNIX commands at some time in the future. At time time on day day, the commands in filefile will be executed. Often used to do time-consuming

More information

CS 246 Winter Tutorial 2

CS 246 Winter Tutorial 2 CS 246 Winter 2016 - Tutorial 2 Detailed Version January 14, 2016 1 Summary git Stuff File Properties Regular Expressions Output Redirection Piping Commands Basic Scripting Persistent Data Password-less

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 Linux

Introduction to Linux Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 47 Operating Systems Program running all the time Interfaces between other programs and hardware Provides abstractions

More information

Systems Programming/ C and UNIX

Systems Programming/ C and UNIX Systems Programming/ C and UNIX Alice E. Fischer September 6, 2017 Alice E. Fischer Systems Programming Lecture 2... 1/28 September 6, 2017 1 / 28 Outline 1 Booting into Linux 2 The Command Shell 3 Defining

More information

Basic Unix Command. It is used to see the manual of the various command. It helps in selecting the correct options

Basic Unix Command. It is used to see the manual of the various command. It helps in selecting the correct options Basic Unix Command The Unix command has the following common pattern command_name options argument(s) Here we are trying to give some of the basic unix command in Unix Information Related man It is used

More information

UNIX ASSIGNMENT 1 TYBCA (Sem:V)

UNIX ASSIGNMENT 1 TYBCA (Sem:V) UNIX ASSIGNMENT 1 TYBCA (Sem:V) Given Date: 06-08-2015 1. Explain the difference between the following thru example ln & paste tee & (pipeline) 2. What is the difference between the following commands

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

Common UNIX Utilities Alphabetical List

Common UNIX Utilities Alphabetical List Common UNIX Utilities Alphabetical List addbib - create or extend a bibliographic database apropos - locate commands by keyword lookup ar - create library archives, and add or extract files at - execute

More information

Essentials for Scientific Computing: Bash Shell Scripting Day 3

Essentials for Scientific Computing: Bash Shell Scripting Day 3 Essentials for Scientific Computing: Bash Shell Scripting Day 3 Ershaad Ahamed TUE-CMS, JNCASR May 2012 1 Introduction In the previous sessions, you have been using basic commands in the shell. The bash

More information

Fall Lecture 5. Operating Systems: Configuration & Use CIS345. The Linux Utilities. Mostafa Z. Ali.

Fall Lecture 5. Operating Systems: Configuration & Use CIS345. The Linux Utilities. Mostafa Z. Ali. Fall 2009 Lecture 5 Operating Systems: Configuration & Use CIS345 The Linux Utilities Mostafa Z. Ali mzali@just.edu.jo 1 1 The Linux Utilities Linux did not have a GUI. It ran on character based terminals

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

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

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

RH033 Red Hat Linux Essentials

RH033 Red Hat Linux Essentials RH033 Red Hat Linux Essentials Version 3.5 QUESTION NO: 1 You work as a Network Administrator for McNeil Inc. The company has a Linux-based network. A printer is configured on the network. You want to

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

Unleashing the Shell Hands-On UNIX System Administration DeCal Week 6 28 February 2011

Unleashing the Shell Hands-On UNIX System Administration DeCal Week 6 28 February 2011 Unleashing the Shell Hands-On UNIX System Administration DeCal Week 6 28 February 2011 Last time Compiling software and the three-step procedure (./configure && make && make install). Dependency hell and

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

client X11 Linux workstation

client X11 Linux workstation LPIC1 LPIC Linux: System Administrator LPIC 1 LPI command line LPIC-1 Linux LPIC-1 client X11 Linux workstation Unix GNU Linux Fundamentals Unix and its Design Principles FSF and GNU GPL - General Public

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

http://xkcd.com/208/ 1. Review of pipes 2. Regular expressions 3. sed 4. Editing Files 5. Shell loops 6. Shell scripts cat seqs.fa >0! TGCAGGTATATCTATTAGCAGGTTTAATTTTGCCTGCACTTGGTTGGGTACATTATTTTAAGTGTATTTGACAAG!

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

COMP2100/2500 Lecture 17: Shell Programming II

COMP2100/2500 Lecture 17: Shell Programming II [ANU] [DCS] [COMP2100/2500] [Description] [Schedule] [Lectures] [Labs] [Homework] [Assignments] [COMP2500] [Assessment] [PSP] [Java] [Reading] [Help] COMP2100/2500 Lecture 17: Shell Programming II Summary

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

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

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

Essential Unix (and Linux) for the Oracle DBA. Revision no.: PPT/2K403/02

Essential Unix (and Linux) for the Oracle DBA. Revision no.: PPT/2K403/02 Essential Unix (and Linux) for the Oracle DBA Revision no.: PPT/2K403/02 Architecture of UNIX Systems 2 UNIX System Structure 3 Operating system interacts directly with Hardware Provides common services

More information

Cisco IOS Shell. Finding Feature Information. Prerequisites for Cisco IOS.sh. Last Updated: December 14, 2012

Cisco IOS Shell. Finding Feature Information. Prerequisites for Cisco IOS.sh. Last Updated: December 14, 2012 Cisco IOS Shell Last Updated: December 14, 2012 The Cisco IOS Shell (IOS.sh) feature provides shell scripting capability to the Cisco IOS command-lineinterface (CLI) environment. Cisco IOS.sh enhances

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

Shells & Shell Programming (Part B)

Shells & Shell Programming (Part B) Shells & Shell Programming (Part B) Software Tools EECS2031 Winter 2018 Manos Papagelis Thanks to Karen Reid and Alan J Rosenthal for material in these slides CONTROL STATEMENTS 2 Control Statements Conditional

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

Practical Session 0 Introduction to Linux

Practical Session 0 Introduction to Linux School of Computer Science and Software Engineering Clayton Campus, Monash University CSE2303 and CSE2304 Semester I, 2001 Practical Session 0 Introduction to Linux Novell accounts. Every Monash student

More information

Contents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version...

Contents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version... Contents Note: pay attention to where you are........................................... 1 Note: Plaintext version................................................... 1 Hello World of the Bash shell 2 Accessing

More information