SlideShare a Scribd company logo
1 of 34
Download to read offline
Shell Scripting

                     An Introduction to 
                    Linux Shell Scripting


                             Vern Ceder
                    Canterbury School, Fort Wayne



Intro to Shell Scripting
Vern Ceder
Canterbury School
This talk ISN'T for

    # Experienced shell scripters
    # People who own T­shirts saying 
      “Go away or I will replace you 
      with a very small shell script”
    # Anyone with a favorite shell 
      hack they MUST share... ;)


Intro to Shell Scripting
Vern Ceder
Canterbury School
This talk is for you if...

    # You can open a terminal
    # You can type
    # You're interested in how to 
      combine those two things to make 
      your life easier 



Intro to Shell Scripting
Vern Ceder
Canterbury School
What's Coming

    # Why use the shell?
    # Basic shell commands
    # Combining shell commands
    # Creating simple scripts
    # Automation with cron


Intro to Shell Scripting
Vern Ceder
Canterbury School
Do you...




Intro to Shell Scripting
Vern Ceder
Canterbury School
$ Need to manage computers not on your 
       desk?
                        
     $ Need to perform complex operations, 
       on lots of files?
     $ Need to repeat the same operations 
       on a lot of machines?
     $ Wish that some of this routine stuff 
       could just happen?




Intro to Shell Scripting
Vern Ceder
Canterbury School
What's a “shell”?

    # A program that uses (text) 
      commands to talk to the OS
    # DOS (e.g.)
    # sh, bash, csh, ksh, zsh, etc...
    # This talk will assume bash


Intro to Shell Scripting
Vern Ceder
Canterbury School
Basic Shell Commands

# Files – ls, cp, mv, rm, mkdir
# Access – chmod, chown
# Disks – df, mount 
# Processes – ps, kill, fg, bg
# Network – ifconfig, ping, tracepath


Intro to Shell Scripting
Vern Ceder
Canterbury School
Take ls, for example
    # ls                   list files
    # ls ­l                list more info
    # ls ­a                list ALL
    # ls ­t                list by date
    # ls ­R                list Recursive
    # ls ­latR             or combine



Intro to Shell Scripting
Vern Ceder
Canterbury School
More file commands
    # cp a b               copy files
    # mv a b               move (rename)
    # rm a                 delete 
    # rm ­rf a             remove EVERYTHING 
                           (danger, danger)




Intro to Shell Scripting
Vern Ceder
Canterbury School
Access commands
    # chown user:group a     change file owner
    # chmod ugo+rwx a        change permissions




Intro to Shell Scripting
Vern Ceder
Canterbury School
disk commands
    # df                      get free space
    # du /folder              get amount used
    # mount                   show/change disks 
                              mounted




Intro to Shell Scripting
Vern Ceder
Canterbury School
process commands
    # ps ax                  show processes
    # kill processid         kill a process
    # fg                     foreground
    # bg                     background




Intro to Shell Scripting
Vern Ceder
Canterbury School
network commands
    # ifconfig               show interfaces
    # ping                   ping a host
    # tracepath              follow a packet




Intro to Shell Scripting
Vern Ceder
Canterbury School
So you can...

    # Manage files
    # Monitor disks
    # Control user access
    # Manage/debug network connections



Intro to Shell Scripting
Vern Ceder
Canterbury School
DANGER! 

       You can also...
       Completely destroy your system
       Don't experiment/practice as 
       root!




Intro to Shell Scripting
Vern Ceder
Canterbury School
But how do you know 
             what does what?
    # Man – the best way to find out 
      what a command does
    # Apropos – the way to find the 
      right command
    # tldp.org – man pages and howto's
    # Google ;) 

Intro to Shell Scripting
Vern Ceder
Canterbury School
So?

       How is this better than using a 
       file manager?
    # Powerful – you can do ANYTHING
    # Remote – you can do it from 
      ANYWHERE
    # “Combinable” (that's next)

Intro to Shell Scripting
Vern Ceder
Canterbury School
The “unix idea”

    # Small, specific utilities
    # Text input/output
    # “pipes” to connect one utility 
      to another




Intro to Shell Scripting
Vern Ceder
Canterbury School
Commands to pull 
                it all together
    # cat                  dump file
    # grep                 find a pattern
    # cut                  cut out a field
    # sort                 sort
    # uniq                 remove dupes
    # head, tail           get part of file
    # more, less           page through file

Intro to Shell Scripting
Vern Ceder
Canterbury School
Introducing the “pipe”

    # | connects the output of one 
      command to the input of another
    # > (and >>) puts the output into 
      a file
    # < puts a file to input



Intro to Shell Scripting
Vern Ceder
Canterbury School
For example...

       Find out who is hogging the home 
       disk...
    # du 
    # sort 
    # tail 
    # du ­cks * | sort ­rn | head

Intro to Shell Scripting
Vern Ceder
Canterbury School
Another example...
       Who's tried to log into your box?
    # cat 
    # grep 
    # cut 
    # sort 
    # uniq 

Intro to Shell Scripting
Vern Ceder
Canterbury School
cat /var/log/auth.log | grep 
   "Failed password" | grep ­v 
   "invalid" | cut ­d " " ­f 9,11 | 
   sort | uniq




Intro to Shell Scripting
Vern Ceder
Canterbury School
Scripts

    # To avoid retyping (and sometimes 
      refiguring out)
    # To handle more complex chores




Intro to Shell Scripting
Vern Ceder
Canterbury School
Creating a simple script

    # Text file (text editor)
    # The “shebang” line
    # Shell commands
    # Make it executable



Intro to Shell Scripting
Vern Ceder
Canterbury School
“space hog” as script

       #!/bin/bash


       du ­cks $1 | sort ­rn | head




Intro to Shell Scripting
Vern Ceder
Canterbury School
“login finder” as script

   Login finder as a script
   cat $1 | grep "Failed password"  
   | grep ­v "invalid" | 
   cut ­d " " ­f 9,11 |grep $2 | 
   sort | uniq


Intro to Shell Scripting
Vern Ceder
Canterbury School
What I didn't cover
                     (a very partial list)

    # find                      # editors 
    # tar                       # Sed & awk
    # environment               # cron & crontab
      vars                      # loops 
    # echo                      # if 
    # sleep                     # test ( [ ] )
Intro to Shell Scripting
Vern Ceder
Canterbury School
But what about automation?

       What if you need to repeat the 
       same script every month? Every 
       week? Every day? Every hour? 
       Every minute?




Intro to Shell Scripting
Vern Ceder
Canterbury School
Automating with cron

# cron lets you run scripts at any 
  time, as any user




Intro to Shell Scripting
Vern Ceder
Canterbury School
Print Resources
# Classic Shell Scripting, Robbins & Beebe, 
  O'Reilly
# Think Linux, Jon Lasser, QUE
# UNIX Hints and Hacks, Kirk Waingrow, QUE
# Linux in a Nutshell, Ellen Siever, et al. 
  O'Reilly
# Many books on Linux/UNIX automation and 
  administration

Intro to Shell Scripting
Vern Ceder
Canterbury School
Web Resources
# See http://tech.canterburyschool.org/tech/shell 
# Google “linux shell scripting” or the like




Intro to Shell Scripting
Vern Ceder
Canterbury School
Video Resources
# http://video.google.com 
   Search for “linux shell scripting tutorial”




Intro to Shell Scripting
Vern Ceder
Canterbury School

More Related Content

What's hot

Bash shell scripting
Bash shell scriptingBash shell scripting
Bash shell scriptingVIKAS TIWARI
 
Complete Guide for Linux shell programming
Complete Guide for Linux shell programmingComplete Guide for Linux shell programming
Complete Guide for Linux shell programmingsudhir singh yadav
 
Linux basic commands
Linux basic commandsLinux basic commands
Linux basic commandsSagar Kumar
 
Introduction to Linux
Introduction to Linux Introduction to Linux
Introduction to Linux Harish R
 
Linux Basic Commands
Linux Basic CommandsLinux Basic Commands
Linux Basic CommandsHanan Nmr
 
Grep - A powerful search utility
Grep - A powerful search utilityGrep - A powerful search utility
Grep - A powerful search utilityNirajan Pant
 
Introduction to Shell script
Introduction to Shell scriptIntroduction to Shell script
Introduction to Shell scriptBhavesh Padharia
 
Linux command ppt
Linux command pptLinux command ppt
Linux command pptkalyanineve
 
Some basic unix commands
Some basic unix commandsSome basic unix commands
Some basic unix commandsaaj_sarkar06
 
Basic commands of linux
Basic commands of linuxBasic commands of linux
Basic commands of linuxshravan saini
 
Linux : Booting and runlevels
Linux : Booting and runlevelsLinux : Booting and runlevels
Linux : Booting and runlevelsJohn Ombagi
 
Bash shell
Bash shellBash shell
Bash shellxylas121
 
Shell Scripting Tutorial | Edureka
Shell Scripting Tutorial | EdurekaShell Scripting Tutorial | Edureka
Shell Scripting Tutorial | EdurekaEdureka!
 
Introduction to the linux command line.pdf
Introduction to the linux command line.pdfIntroduction to the linux command line.pdf
Introduction to the linux command line.pdfCesleySCruz
 
Server configuration
Server configurationServer configuration
Server configurationAisha Talat
 
Unix shell scripting basics
Unix shell scripting basicsUnix shell scripting basics
Unix shell scripting basicsManav Prasad
 

What's hot (20)

Bash shell scripting
Bash shell scriptingBash shell scripting
Bash shell scripting
 
Complete Guide for Linux shell programming
Complete Guide for Linux shell programmingComplete Guide for Linux shell programming
Complete Guide for Linux shell programming
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Linux basic commands
Linux basic commandsLinux basic commands
Linux basic commands
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Introduction to Linux
Introduction to Linux Introduction to Linux
Introduction to Linux
 
Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commands
 
Linux Basic Commands
Linux Basic CommandsLinux Basic Commands
Linux Basic Commands
 
Grep - A powerful search utility
Grep - A powerful search utilityGrep - A powerful search utility
Grep - A powerful search utility
 
Introduction to Shell script
Introduction to Shell scriptIntroduction to Shell script
Introduction to Shell script
 
Linux command ppt
Linux command pptLinux command ppt
Linux command ppt
 
Some basic unix commands
Some basic unix commandsSome basic unix commands
Some basic unix commands
 
Basic commands of linux
Basic commands of linuxBasic commands of linux
Basic commands of linux
 
Linux : Booting and runlevels
Linux : Booting and runlevelsLinux : Booting and runlevels
Linux : Booting and runlevels
 
Bash shell
Bash shellBash shell
Bash shell
 
Shell Scripting Tutorial | Edureka
Shell Scripting Tutorial | EdurekaShell Scripting Tutorial | Edureka
Shell Scripting Tutorial | Edureka
 
Linux architecture
Linux architectureLinux architecture
Linux architecture
 
Introduction to the linux command line.pdf
Introduction to the linux command line.pdfIntroduction to the linux command line.pdf
Introduction to the linux command line.pdf
 
Server configuration
Server configurationServer configuration
Server configuration
 
Unix shell scripting basics
Unix shell scripting basicsUnix shell scripting basics
Unix shell scripting basics
 

Viewers also liked

Quick start bash script
Quick start   bash scriptQuick start   bash script
Quick start bash scriptSimon Su
 
Unix Shell Scripting
Unix Shell ScriptingUnix Shell Scripting
Unix Shell ScriptingMustafa Qasim
 
OpenGurukul : Language : Shell Scripting
OpenGurukul : Language : Shell ScriptingOpenGurukul : Language : Shell Scripting
OpenGurukul : Language : Shell ScriptingOpen Gurukul
 
Basic command ppt
Basic command pptBasic command ppt
Basic command pptRohit Kumar
 
Let us c(by yashwant kanetkar) chapter 2 solution
Let us c(by yashwant kanetkar) chapter 2 solutionLet us c(by yashwant kanetkar) chapter 2 solution
Let us c(by yashwant kanetkar) chapter 2 solutionrohit kumar
 
Unix Shell Scripting Basics
Unix Shell Scripting BasicsUnix Shell Scripting Basics
Unix Shell Scripting BasicsDr.Ravi
 
Linux ppt
Linux pptLinux ppt
Linux pptlincy21
 

Viewers also liked (7)

Quick start bash script
Quick start   bash scriptQuick start   bash script
Quick start bash script
 
Unix Shell Scripting
Unix Shell ScriptingUnix Shell Scripting
Unix Shell Scripting
 
OpenGurukul : Language : Shell Scripting
OpenGurukul : Language : Shell ScriptingOpenGurukul : Language : Shell Scripting
OpenGurukul : Language : Shell Scripting
 
Basic command ppt
Basic command pptBasic command ppt
Basic command ppt
 
Let us c(by yashwant kanetkar) chapter 2 solution
Let us c(by yashwant kanetkar) chapter 2 solutionLet us c(by yashwant kanetkar) chapter 2 solution
Let us c(by yashwant kanetkar) chapter 2 solution
 
Unix Shell Scripting Basics
Unix Shell Scripting BasicsUnix Shell Scripting Basics
Unix Shell Scripting Basics
 
Linux ppt
Linux pptLinux ppt
Linux ppt
 

Similar to Intro to Linux Shell Scripting

Shell tutorial
Shell tutorialShell tutorial
Shell tutorialVu Duy Tu
 
Airlover 20030324 1
Airlover 20030324 1Airlover 20030324 1
Airlover 20030324 1Dr.Ravi
 
Phoenix Servers with Docker and Nginx
Phoenix Servers with Docker and NginxPhoenix Servers with Docker and Nginx
Phoenix Servers with Docker and NginxNils De Moor
 
Shell Scripting crash course.pdf
Shell Scripting crash course.pdfShell Scripting crash course.pdf
Shell Scripting crash course.pdfharikrishnapolaki
 
Bioinformatica 29-09-2011-p1-introduction
Bioinformatica 29-09-2011-p1-introductionBioinformatica 29-09-2011-p1-introduction
Bioinformatica 29-09-2011-p1-introductionProf. Wim Van Criekinge
 
390aLecture05_12sp.ppt
390aLecture05_12sp.ppt390aLecture05_12sp.ppt
390aLecture05_12sp.pptmugeshmsd5
 
(Ebook) linux shell scripting tutorial
(Ebook) linux shell scripting tutorial(Ebook) linux shell scripting tutorial
(Ebook) linux shell scripting tutorialjayaramprabhu
 
RSpec 3.0: Under the Covers
RSpec 3.0: Under the CoversRSpec 3.0: Under the Covers
RSpec 3.0: Under the CoversBrian Gesiak
 
Shell scrpting(payal harne)
Shell scrpting(payal harne)Shell scrpting(payal harne)
Shell scrpting(payal harne)PayalHarne
 
Microarmy - by J2 Labs
Microarmy - by J2 LabsMicroarmy - by J2 Labs
Microarmy - by J2 LabsJames Dennis
 
Course 102: Lecture 10: Learning About the Shell
Course 102: Lecture 10: Learning About the Shell Course 102: Lecture 10: Learning About the Shell
Course 102: Lecture 10: Learning About the Shell Ahmed El-Arabawy
 
Geecon 2019 - Taming Code Quality in the Worst Language I Know: Bash
Geecon 2019 - Taming Code Quality  in the Worst Language I Know: BashGeecon 2019 - Taming Code Quality  in the Worst Language I Know: Bash
Geecon 2019 - Taming Code Quality in the Worst Language I Know: BashMichał Kordas
 
Introduction to perl_ a scripting language
Introduction to perl_ a scripting languageIntroduction to perl_ a scripting language
Introduction to perl_ a scripting languageVamshi Santhapuri
 
PASS 24HOP Linux Scripting Tips and Tricks
PASS 24HOP Linux Scripting Tips and TricksPASS 24HOP Linux Scripting Tips and Tricks
PASS 24HOP Linux Scripting Tips and TricksKellyn Pot'Vin-Gorman
 
Get-Help: An intro to PowerShell and how to Use it for Evil
Get-Help: An intro to PowerShell and how to Use it for EvilGet-Help: An intro to PowerShell and how to Use it for Evil
Get-Help: An intro to PowerShell and how to Use it for Eviljaredhaight
 
InSpec Workshop DevSecCon 2017
InSpec Workshop DevSecCon 2017InSpec Workshop DevSecCon 2017
InSpec Workshop DevSecCon 2017Mandi Walls
 

Similar to Intro to Linux Shell Scripting (20)

Shell tutorial
Shell tutorialShell tutorial
Shell tutorial
 
Bash 4
Bash 4Bash 4
Bash 4
 
Airlover 20030324 1
Airlover 20030324 1Airlover 20030324 1
Airlover 20030324 1
 
Phoenix Servers with Docker and Nginx
Phoenix Servers with Docker and NginxPhoenix Servers with Docker and Nginx
Phoenix Servers with Docker and Nginx
 
Shell Scripting crash course.pdf
Shell Scripting crash course.pdfShell Scripting crash course.pdf
Shell Scripting crash course.pdf
 
Bioinformatica 29-09-2011-p1-introduction
Bioinformatica 29-09-2011-p1-introductionBioinformatica 29-09-2011-p1-introduction
Bioinformatica 29-09-2011-p1-introduction
 
390aLecture05_12sp.ppt
390aLecture05_12sp.ppt390aLecture05_12sp.ppt
390aLecture05_12sp.ppt
 
21bUc8YeDzZpE
21bUc8YeDzZpE21bUc8YeDzZpE
21bUc8YeDzZpE
 
21bUc8YeDzZpE
21bUc8YeDzZpE21bUc8YeDzZpE
21bUc8YeDzZpE
 
21bUc8YeDzZpE
21bUc8YeDzZpE21bUc8YeDzZpE
21bUc8YeDzZpE
 
(Ebook) linux shell scripting tutorial
(Ebook) linux shell scripting tutorial(Ebook) linux shell scripting tutorial
(Ebook) linux shell scripting tutorial
 
RSpec 3.0: Under the Covers
RSpec 3.0: Under the CoversRSpec 3.0: Under the Covers
RSpec 3.0: Under the Covers
 
Shell scrpting(payal harne)
Shell scrpting(payal harne)Shell scrpting(payal harne)
Shell scrpting(payal harne)
 
Microarmy - by J2 Labs
Microarmy - by J2 LabsMicroarmy - by J2 Labs
Microarmy - by J2 Labs
 
Course 102: Lecture 10: Learning About the Shell
Course 102: Lecture 10: Learning About the Shell Course 102: Lecture 10: Learning About the Shell
Course 102: Lecture 10: Learning About the Shell
 
Geecon 2019 - Taming Code Quality in the Worst Language I Know: Bash
Geecon 2019 - Taming Code Quality  in the Worst Language I Know: BashGeecon 2019 - Taming Code Quality  in the Worst Language I Know: Bash
Geecon 2019 - Taming Code Quality in the Worst Language I Know: Bash
 
Introduction to perl_ a scripting language
Introduction to perl_ a scripting languageIntroduction to perl_ a scripting language
Introduction to perl_ a scripting language
 
PASS 24HOP Linux Scripting Tips and Tricks
PASS 24HOP Linux Scripting Tips and TricksPASS 24HOP Linux Scripting Tips and Tricks
PASS 24HOP Linux Scripting Tips and Tricks
 
Get-Help: An intro to PowerShell and how to Use it for Evil
Get-Help: An intro to PowerShell and how to Use it for EvilGet-Help: An intro to PowerShell and how to Use it for Evil
Get-Help: An intro to PowerShell and how to Use it for Evil
 
InSpec Workshop DevSecCon 2017
InSpec Workshop DevSecCon 2017InSpec Workshop DevSecCon 2017
InSpec Workshop DevSecCon 2017
 

Intro to Linux Shell Scripting

  • 1. Shell Scripting An Introduction to  Linux Shell Scripting Vern Ceder Canterbury School, Fort Wayne Intro to Shell Scripting Vern Ceder Canterbury School
  • 2. This talk ISN'T for # Experienced shell scripters # People who own T­shirts saying  “Go away or I will replace you  with a very small shell script” # Anyone with a favorite shell  hack they MUST share... ;) Intro to Shell Scripting Vern Ceder Canterbury School
  • 3. This talk is for you if... # You can open a terminal # You can type # You're interested in how to  combine those two things to make  your life easier  Intro to Shell Scripting Vern Ceder Canterbury School
  • 4. What's Coming # Why use the shell? # Basic shell commands # Combining shell commands # Creating simple scripts # Automation with cron Intro to Shell Scripting Vern Ceder Canterbury School
  • 6. $ Need to manage computers not on your  desk?   $ Need to perform complex operations,  on lots of files? $ Need to repeat the same operations  on a lot of machines? $ Wish that some of this routine stuff  could just happen? Intro to Shell Scripting Vern Ceder Canterbury School
  • 7. What's a “shell”? # A program that uses (text)  commands to talk to the OS # DOS (e.g.) # sh, bash, csh, ksh, zsh, etc... # This talk will assume bash Intro to Shell Scripting Vern Ceder Canterbury School
  • 8. Basic Shell Commands # Files – ls, cp, mv, rm, mkdir # Access – chmod, chown # Disks – df, mount  # Processes – ps, kill, fg, bg # Network – ifconfig, ping, tracepath Intro to Shell Scripting Vern Ceder Canterbury School
  • 9. Take ls, for example # ls    list files # ls ­l list more info # ls ­a list ALL # ls ­t list by date # ls ­R list Recursive # ls ­latR or combine Intro to Shell Scripting Vern Ceder Canterbury School
  • 10. More file commands # cp a b   copy files # mv a b move (rename) # rm a delete  # rm ­rf a remove EVERYTHING  (danger, danger) Intro to Shell Scripting Vern Ceder Canterbury School
  • 11. Access commands # chown user:group a   change file owner # chmod ugo+rwx a change permissions Intro to Shell Scripting Vern Ceder Canterbury School
  • 12. disk commands # df    get free space # du /folder get amount used # mount show/change disks  mounted Intro to Shell Scripting Vern Ceder Canterbury School
  • 13. process commands # ps ax   show processes # kill processid kill a process # fg  foreground # bg  background Intro to Shell Scripting Vern Ceder Canterbury School
  • 14. network commands # ifconfig   show interfaces # ping ping a host # tracepath  follow a packet Intro to Shell Scripting Vern Ceder Canterbury School
  • 15. So you can... # Manage files # Monitor disks # Control user access # Manage/debug network connections Intro to Shell Scripting Vern Ceder Canterbury School
  • 16. DANGER!  You can also... Completely destroy your system Don't experiment/practice as  root! Intro to Shell Scripting Vern Ceder Canterbury School
  • 17. But how do you know  what does what? # Man – the best way to find out  what a command does # Apropos – the way to find the  right command # tldp.org – man pages and howto's # Google ;)  Intro to Shell Scripting Vern Ceder Canterbury School
  • 18. So? How is this better than using a  file manager? # Powerful – you can do ANYTHING # Remote – you can do it from  ANYWHERE # “Combinable” (that's next) Intro to Shell Scripting Vern Ceder Canterbury School
  • 19. The “unix idea” # Small, specific utilities # Text input/output # “pipes” to connect one utility  to another Intro to Shell Scripting Vern Ceder Canterbury School
  • 20. Commands to pull  it all together # cat    dump file # grep  find a pattern # cut cut out a field # sort sort # uniq remove dupes # head, tail get part of file # more, less page through file Intro to Shell Scripting Vern Ceder Canterbury School
  • 21. Introducing the “pipe” # | connects the output of one  command to the input of another # > (and >>) puts the output into  a file # < puts a file to input Intro to Shell Scripting Vern Ceder Canterbury School
  • 22. For example... Find out who is hogging the home  disk... # du  # sort  # tail  # du ­cks * | sort ­rn | head Intro to Shell Scripting Vern Ceder Canterbury School
  • 23. Another example... Who's tried to log into your box? # cat  # grep  # cut  # sort  # uniq  Intro to Shell Scripting Vern Ceder Canterbury School
  • 24. cat /var/log/auth.log | grep  "Failed password" | grep ­v  "invalid" | cut ­d " " ­f 9,11 |  sort | uniq Intro to Shell Scripting Vern Ceder Canterbury School
  • 25. Scripts # To avoid retyping (and sometimes  refiguring out) # To handle more complex chores Intro to Shell Scripting Vern Ceder Canterbury School
  • 26. Creating a simple script # Text file (text editor) # The “shebang” line # Shell commands # Make it executable Intro to Shell Scripting Vern Ceder Canterbury School
  • 27. “space hog” as script #!/bin/bash du ­cks $1 | sort ­rn | head Intro to Shell Scripting Vern Ceder Canterbury School
  • 28. “login finder” as script Login finder as a script cat $1 | grep "Failed password"   | grep ­v "invalid" |  cut ­d " " ­f 9,11 |grep $2 |  sort | uniq Intro to Shell Scripting Vern Ceder Canterbury School
  • 29. What I didn't cover (a very partial list) # find # editors  # tar # Sed & awk # environment  # cron & crontab vars # loops  # echo  # if  # sleep  # test ( [ ] ) Intro to Shell Scripting Vern Ceder Canterbury School
  • 30. But what about automation? What if you need to repeat the  same script every month? Every  week? Every day? Every hour?  Every minute? Intro to Shell Scripting Vern Ceder Canterbury School
  • 31. Automating with cron # cron lets you run scripts at any  time, as any user Intro to Shell Scripting Vern Ceder Canterbury School
  • 32. Print Resources # Classic Shell Scripting, Robbins & Beebe,  O'Reilly # Think Linux, Jon Lasser, QUE # UNIX Hints and Hacks, Kirk Waingrow, QUE # Linux in a Nutshell, Ellen Siever, et al.  O'Reilly # Many books on Linux/UNIX automation and  administration Intro to Shell Scripting Vern Ceder Canterbury School
  • 34. Video Resources # http://video.google.com  Search for “linux shell scripting tutorial” Intro to Shell Scripting Vern Ceder Canterbury School