1 / 39

Session 6 Files Systems: Hands-On

Session 6 Files Systems: Hands-On. File Systems (1). Essential requirements for long-term information storage: It must be possible to store a very large amount of information . The information must survive the termination of the process using it.

jaxon
Download Presentation

Session 6 Files Systems: Hands-On

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. Nassau Community College ITE153 – Operating Systems Session 6Files Systems: Hands-On

  2. File Systems (1) Nassau Community College ITE153 – Operating Systems • Essential requirements for long-term information storage: • It must be possible to store a very large amount of information. • The information must survive the terminationof the process using it. • Multiple processes must be able to access the information concurrently.

  3. File Systems (2) Nassau Community College ITE153 – Operating Systems • Think of a disk as a linear sequence of fixed-size blocks and supporting reading and writing of blocks. Questions that quickly arise: • How do you find information? • How do you keep one user from reading another’s data? • How do you know which blocks are free?

  4. File Naming Nassau Community College ITE153 – Operating Systems Some typical file extensions.

  5. File Attributes Nassau Community College ITE153 – Operating Systems Some possible file attributes.

  6. File Operations Nassau Community College ITE153 – Operating Systems • The most common system calls relating to files: • Append • Seek • Get Attributes • Set Attributes • Rename • Create • Delete • Open • Close • Read • Write

  7. Nassau Community College ITE153 – Operating Systems Session 6Files Systems: Hands-On Commands

  8. File & Directory Permissions Nassau Community College ITE153 – Operating Systems Unit Objectives: By the end of this unit, you will be able to: • Use the ls command to determine existing permissions on files and directories • Describe the significance of permission settings • Change permissions using the chmod command • Determine default permissions for new files and directories • Change the default permissions for new files and directories

  9. Overview of Security Permissions Nassau Community College ITE153 – Operating Systems • View existing permissions using ls -l $ ls -l drwxr-xr-x 2 cajs office 32 nov 27 2002 06:33 DOCS - rw-r--r-- 1 cajs office 96 nov 27 2002 14:12 abc

  10. Nassau Community College ITE153 – Operating Systems Permission Symbols

  11. Changing Permisssions with chmod Nassau Community College ITE153 – Operating Systems • chmod SETTING NAME(s) • SETTING • Symbolic or Octal notation • Use symbols or octal numbers • $ chmod g+w my.file • $ chmod 664 my.file • NAME(s) • Name of file(s) or directory(s)

  12. Symbolic Notation u user g group o other + add - subtract = set exactly r read w write x execute Symbolic setting examples u+r ugo+x g=r go+w ugo=rw g-w ug+w,o-r $ chmod settingfilename(s) Nassau Community College ITE153 – Operating Systems

  13. Nassau Community College ITE153 – Operating Systems Practice Using Symbols

  14. Octal Notation Common Octal Settings Directories 777 drwxrwxrwx 755 drwxr-xr-x 700 drwx------ Files 777 -rwxrwxrwx 644 -rw-r--r-- Shortcut Setting Value r 4 w 2 x 1 - 0 rwxrw-rw- is 766 rwx 4+2+1=7 rw 4+2+0=6 rw 4+2+0=6 Nassau Community College ITE153 – Operating Systems

  15. Nassau Community College ITE153 – Operating Systems Practice With Octal

  16. Default File & Directory Permissions Nassau Community College ITE153 – Operating Systems • The chmod command changes EXISTING file or directory permissions. • DEFAULT permissions • Used when new files or directories are created • For files: 666 • For directories: 777 • Default can be modified using the umask command

  17. umask Settings Nassau Community College ITE153 – Operating Systems • umask uses Octal notation • To determine existing umask setting:$ umask • To change umask setting:$ umask 022 • File default becomes: -rw-r--r-- • Directory default becomes: drwxr-xr-x

  18. Nassau Community College ITE153 – Operating Systems Common umask Settings

  19. Hands-onExercises Nassau Community College ITE153 – Operating Systems

  20. Nassau Community College ITE153 – Operating Systems Session 6vi Editor: Hands-On Commands

  21. Basics of the vi Editor Nassau Community College ITE153 – Operating Systems By the end of this unit, you will be able to: • Describe the features of a text editor • List the modes of the vi editor • Use commands to move around a text file • Use input commands to enter text • Perform a global substitution • Escape to the shell • Create an abbreviation • Save your file • Exit the vi editor

  22. vi Overview vi is a text editor No automatic formatting Not a word processor With vi, you can: Create text Edit text Delete text Search for text Much more… Nassau Community College ITE153 – Operating Systems

  23. Inventor of vi Editor Nassau Community College ITE153 – Operating Systems • wrote the vi editor in a weekend, 1976 • largely responsible for managing the authorship of BSD UNIX • co-founded Sun Microsystems in 1982 • lives in Aspen

  24. vi Modes Nassau Community College ITE153 – Operating Systems a, i, o... <enter> Input Command ex <esc> : $ $ vi filename

  25. Moving the Cursor: Little Moves In Command Mode Moving by line:<enter> Moving by words:w W Moving by character:<space><backspace> Nassau Community College ITE153 – Operating Systems

  26. Moving the Cursor: Big Moves In Command Mode Scroll up and down:<ctrl-u><ctrl-d> Move within the screen:H homeM middleL last Move to a specified line:6G Move to line sixG Move to the last line Where am I?<ctrl-g> Nassau Community College ITE153 – Operating Systems

  27. Entering Text In Command Mode Type an Input command (i,a,o,O) Type the text you want to enter Press <esc> to return to CommandMode Input commands are relative to the cursor: Nassau Community College ITE153 – Operating Systems O a i o

  28. Changing Text Nassau Community College ITE153 – Operating Systems • Change word: cw • Change 3 words: 3cw • Change current line: cc The change command: • Displays a $ at the end of the word(s) or line to be changed • Puts you into input mode • Use <esc> to return to command mode • A number before the command multiplies the action

  29. Deleting Text Nassau Community College ITE153 – Operating Systems • Delete word dw • Delete 5 words 5dw • Delete current line dd • Delete current character x • A number before the command multiplies the action.

  30. The Undo Command Nassau Community College ITE153 – Operating Systems • u Undo the last change • U Restores the current line (Even after several changes.)

  31. Searching for Text Nassau Community College ITE153 – Operating Systems • In command mode type: /patternFor example: /edit • Searches forward in the file for the pattern ‘edit’. • Puts cursor on the ‘e’ in the first instance found • Type n (for next) to go to the next instance

  32. Copying & Moving Text Nassau Community College ITE153 – Operating Systems • To copy text use vi’s yank command: • yw yanks (copies) one word • yy yanks (copies) one line • To move text use any of vi’s delete commands like dd, dw, x • To paste:p puts copied or deleted text back at the cursor

  33. ex Mode Nassau Community College ITE153 – Operating Systems • From command mode a : (colon) puts you in ex mode • Some tasks in ex mode: • save(write) and quit (example: :wq!) • make global changes • create abbreviations • customize vi • many more….

  34. Save & Quit Nassau Community College ITE153 – Operating Systems • Write and quit vi :wq • Write without quitting :w • Quit without saving :q! • Write to a new filename :w filename

  35. Global Substitutions Nassau Community College ITE153 – Operating Systems • In ex mode - :[address]s/pattern/replacement/[g] • Examples: • :1, $s/Monday/Friday/g • :.,10s/his/hers/g • :18s/lunch/dinner • :1,.s/rabbits/bunnies/g

  36. Abbreviations • :abbr UOS UNIX Operating System • When you type ‘UOS’ in input mode, vi will replace it with ‘UNIX Operating System’

  37. Hands-onExercises Nassau Community College ITE153 – Operating Systems

  38. Important URLs Nassau Community College ITE153 – Operating Systems • How Linux file permissions work- a little more info about file permissions • What is Umask and How To Setup Default umask Under Linux? – good explanation of umask command • Access Rights and File Security– good write-up on file security • The vi Editor (Wikipedia) – very good history of vi • Learning the vi Editor, Sixth Edition - this is the online (free) version

  39. Homework Nassau Community College ITE153 – Operating Systems • Review the Slides • Keep Practicing Commands • Compare to what you have learned on Linux to Windows

More Related