1 / 26

Lecture 9: Bourne Shell ( ch 8)

Lecture 9: Bourne Shell ( ch 8). IT244 - Introduction to Linux / Unix Instructor: Bo Sheng. Filename Generation/Wildcards. “ [] ” for range echo [ aeiou ]* cat colors.[135] echo [a- z ]* echo *[a- l ] “ ^ ” for “not” echo *[^a- z ] echo [^a- o ]*. Filename Generation/Wildcards.

Download Presentation

Lecture 9: Bourne Shell ( ch 8)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 9: Bourne Shell (ch 8) IT244 - Introduction to Linux / Unix Instructor: Bo Sheng

  2. Filename Generation/Wildcards • “[]” for range • echo [aeiou]* • cat colors.[135] • echo [a-z]* • echo *[a-l] • “^” for “not” • echo *[^a-z] • echo [^a-o]*

  3. Filename Generation/Wildcards • Shell expands ambiguous filenames • ls hello? • ls hello\? The shell searches for matching filenames: hello1, hello2 hello1, hello2 ls hello? shell ls

  4. Execute Commands • Foreground and background jobs • cp ~shengbo/it244/exetest . • ./exetest(CTRL+C to terminate) • ./exetest & (running in background) • jobs

  5. Execute Commands • Foreground and background jobs • One foreground in a terminal • Only foreground gets input from keyboard • Multitasking

  6. Execute Commands • Job number / PID number Job number Process ID

  7. Execute Commands • Job number / PID number Job number Process ID

  8. Execute Commands • Suspend a foreground job • exetest • CTRL+Z • jobs • Different from a running background job

  9. Execute Commands • Resume a suspended job • In the background • bg [%job_number] • In the foreground • fg [%job_number] • Bring background job to foreground

  10. Execute Commands • Abort a job • Foreground • CTRL+C • Background • kill process_ID • kill %job_number • tail –f hello &

  11. Summary • Basic operations • ls, cd, pwd, cat, echo • cp, mv, rm • Overwrite • Interactive option • mkdir, rmdir

  12. Summary • Basic operations • Make a copy of an existing directory • mkdirnew_directory • cp -rold_directory/* new_directory

  13. Summary • Permissions • Read/write/execute • Execute permission on directories • chmod, getfacl/setfacl • Links • Hard links and symbolic links

  14. Summary • More about file system and inode file1 inode Data blocks Inode table

  15. Summary • More about file system and inode file1 inode Data blocks file2 Inode table inode Data blocks

  16. Summary • More about file system and inode file1 inode Data blocks file2 Inode table inode Data blocks Directory

  17. Summary • More about file system and inode file1 ln file1 file3 inode Data blocks file2 Inode table inode Data blocks Directory

  18. Summary • More about file system and inode file1 ln file1 file3 inode Data blocks file2 Inode table inode Data blocks Directory

  19. Summary • More about file system and inode file1 ln –s file1 file3 inode inum4, iaddr4 inode Data blocks file2 Inode table inode Data blocks Directory

  20. Bourne Shell • Redirect standard error

  21. Bourne Shell • Redirect standard error • echo “this is y” > y • cat y • cat x • cat x y > log • cat log • cat x y | tr “[a-z]” “[A-Z]”

  22. Bourne Shell • Redirect standard error • File descriptor • 0: std input, 1: std output, 2: std error • cat x y 1> log 2> err • cat log • cat err

  23. Bourne Shell • Redirect standard error • Combine std input and std error (&>) • cat x y &> log • cat log

  24. Bourne Shell • Redirect standard error • Duplicate a file descriptor (>&) • cat x y 1> log 2>&1 • cat log • cat x y 2>&1 1> log • cat log

  25. Bourne Shell • Redirect standard error • Duplicate a file descriptor (>&) • cat x y 1>log 2>log • cat log • cat y x 1>log 2>log • cat log

  26. Bourne Shell • Redirect standard error • Duplicate a file descriptor (>&) • cat x y 1>&2 • cat x y 2>err 1>&2 • cat x y 1>&2 | tr “[a-z]” “[A-Z]”

More Related