lecture 4 file management starting from
play

Lecture 4: File management starting from / Hands-on Unix System - PowerPoint PPT Presentation

Lecture 4: File management starting from / Hands-on Unix System Administration DeCal 2012-01-30 1 / 32 Review Shell expansion Standard streams Useful commands In a nutshell Review Philosophy Users File hierarchy


  1. Lecture 4: File management starting from / Hands-on Unix System Administration DeCal 2012-01-30 1 / 32

  2. Review ❖ Shell expansion ❖ Standard streams ❖ Useful commands ❖ In a nutshell Review ❖ Philosophy Users File hierarchy Filesystems Files 2 / 32

  3. Shell expansion Review variables ( $PATH , environment ● ❖ Shell expansion variables) ❖ Standard streams aliases ❖ Useful ● commands tilde ❖ In a nutshell ● ❖ Philosophy globbing ● Users backticks File hierarchy ● Filesystems single vs. double quotes ● Files 3 / 32

  4. Standard streams stdin, stdout, stderr Review ● ❖ Shell expansion redirection: > , >> , < ● ❖ Standard streams pipes: | ● ❖ Useful commands tee, xargs ❖ In a nutshell ● ❖ Philosophy Users File hierarchy Filesystems Files 4 / 32

  5. Useful commands Review find ● ❖ Shell expansion tr , sort , head , tail , wc ● ❖ Standard streams for index in $ array ; do ● ❖ Useful commands command ; done ❖ In a nutshell ❖ Philosophy while expression ; do command ; ● Users done File hierarchy regex with grep , sed , awk Filesystems ● Files 5 / 32

  6. In a nutshell RTFM: man, --help command Review ● ❖ Shell expansion line option ❖ Standard streams input : command line options, stdin ● ❖ Useful commands output : stdout, stderr ❖ In a nutshell ● ❖ Philosophy manipulate with pipes ( | ), ● Users redirection ( > , >> ), and substitution File hierarchy Filesystems ( ‘ ) Files 6 / 32

  7. Philosophy Review The highest achievement of the Unix-aesthetic is to have ❖ Shell a command that does precisely one function, and does it expansion well. Purists object that, after freshman programmers at ❖ Standard streams Berkeley got through with it, the program “cat” which ❖ Useful concatenates multiple files to its output now has commands ❖ In a nutshell OPTIONS. . . “Cat came back from Berkeley waving ❖ Philosophy flags,” in the words of Rob Pike, perhaps the ultimate Unix minimalist. —The Unix-Haters Handbook Users File hierarchy This is the Unix philosophy. Write programs that do one Filesystems thing and do it well. Write programs to work together. Files Write programs to handle text streams, because that is a universal interface. —Doug McIlroy 7 / 32

  8. Review Users ❖ Types of users ❖ Groups ❖ NSS databases Users ❖ What’s a user ❖ Who’s logged in File hierarchy Filesystems Files 8 / 32

  9. Types of users root : superuser, virtually unlimited Review ● Users control ❖ Types of users system user accounts ❖ Groups ● ❖ NSS databases typically low UIDs, /bin/false ❖ What’s a ✦ user ❖ Who’s shell logged in File hierarchy real user accounts ● Filesystems Files typically higher UIDs, real shell like ✦ /bin/bash 9 / 32

  10. Groups every user has a primary group and Review ● Users optionally secondary group(s) ❖ Types of users important for file permissions ❖ Groups ● ❖ NSS databases ❖ What’s a user ❖ Who’s logged in File hierarchy Filesystems Files 10 / 32

  11. NSS databases passwd : user information, public Review ● Users ❖ Types of useradd , usermod , chsh , userdel ✦ users ❖ Groups ❖ NSS shadow : “encrypted” (hashed) ● databases ❖ What’s a passwords, only readable by root user ❖ Who’s logged in ✦ passwd File hierarchy Filesystems group : groups ● Files groupadd , groupmod , groupdel ✦ 11 / 32

  12. What’s a user Review $ getent passwd daradib daradib:x:1000:1000:Dara Adib„,:/home/daradib:/bin/bash Users ❖ Types of login name users ● ❖ Groups password hash ❖ NSS ● databases ❖ What’s a numerical user ID ● user ❖ Who’s numerical group ID logged in ● File hierarchy finger info (name, phone, office, etc.) ● Filesystems home directory ● Files shell ● 12 / 32

  13. Who’s logged in who , w : print currently logged in users Review ● Users last : print login-logout log from ● ❖ Types of users /var/log/wtmp , ❖ Groups ❖ NSS /var/log/utmp , or similar databases ❖ What’s a user for more details, use process ● ❖ Who’s logged in accounting File hierarchy Filesystems Files 13 / 32

  14. Review Users File hierarchy ❖ Windows ❖ *nix concept ❖ Looking File hierarchy under / ❖ Looking under / more Filesystems Files 14 / 32

  15. Windows each storage device has a drive letter, Review ● Users e.g. A:\ for floppy, C:\ for hard disk, File hierarchy etc. ❖ Windows ❖ *nix concept important directories ❖ Looking ● under / ❖ Looking under / more C:\Windows ✦ Filesystems ”C:\Program Files” ✦ Files C:\Users ✦ 15 / 32

  16. *nix concept “simplicity through expression” Review ● Users everything starts from the root 1 : / ● File hierarchy excessive (but productive) abbreviation ❖ Windows ● ❖ *nix concept ❖ Looking under / case sensitive ❖ Looking ● under / more Filesystems Files 1 (not to be confused with /root) 16 / 32

  17. Looking under / /bin / core bin aries /dev / dev ice files /etc / systemwide config uration files /home / home dir ectories (user data) /lib / core lib raries /proc / proc fs interface to kernel 17 / 32

  18. Looking under / more /root / root ’s home directory 2 /sbin / to s ystem bin aries /tmp / t e mp orary files /usr / non-core binaries, libraries, etc. /var / var ying files: logs, user inboxes, running program data, etc. 2 (not to be confused with the root /) 18 / 32

  19. Review Users File hierarchy Filesystems ❖ What is a filesystem? Filesystems ❖ Examples ❖ Non- disk/flash filesystems ❖ RAID ❖ RAID examples ❖ Mounting Files 19 / 32

  20. What is a filesystem? Each local hard disk can have one or Review ● Users more partitions which contain files File hierarchy managed by a filesystem Filesystems ❖ What is a filesystem? e.g., /dev/sda , /dev/sda1 ✦ ❖ Examples ❖ Non- disk/flash filesystems ❖ RAID ❖ RAID examples ❖ Mounting Files 20 / 32

  21. Examples Review Windows (and flash drives) ● Users filesystems: FAT32, NTFS File hierarchy Linux: ext3, ext4, btrfs ● Filesystems ❖ What is a Other Unix: UFS, XFS, ZFS, ReiserFS filesystem? ● ❖ Examples ❖ Non- disk/flash filesystems ❖ RAID ❖ RAID examples ❖ Mounting Files 21 / 32

  22. Non-disk/flash filesystems RAM: tmpfs Review ● Users network: NFS, SMB ● File hierarchy FUSE: GmailFS, WikipediaFS ● Filesystems ❖ What is a filesystem? ❖ Examples ❖ Non- disk/flash filesystems ❖ RAID ❖ RAID examples ❖ Mounting Files 22 / 32

  23. RAID Redundant Array of Independent Review ● Users (Inexpensive) Disks File hierarchy combine multiple hard drives for speed ● Filesystems ❖ What is a (striping), capacity, reliability filesystem? ❖ Examples (mirroring, parity) ❖ Non- disk/flash filesystems ❖ RAID ❖ RAID examples ❖ Mounting Files 23 / 32

  24. RAID examples Review common examples: RAID 0 (striping), ● Users RAID1 (mirror), RAID5 (parity), RAID File hierarchy 6 (two parity) Filesystems ❖ What is a nested, e.g., RAID 10 filesystem? ● ❖ Examples ❖ Non- disk/flash filesystems ❖ RAID ❖ RAID examples ❖ Mounting Files 24 / 32

  25. Mounting file hierarchy crosses filesystem Review ● Users boundaries File hierarchy use mount to mount local or ● Filesystems ❖ What is a networked stuff on a directory (mount filesystem? ❖ Examples point) ❖ Non- disk/flash filesystems can mount regular files too ✦ ❖ RAID ❖ RAID examples ❖ Mounting Files 25 / 32

  26. Review Users File hierarchy Filesystems Files Files ❖ ls options ❖ ls -l ❖ Regular files ❖ Other file types ❖ File permissions ❖ Changing file permissions 26 / 32

  27. ls options -l : long listing format Review ● Users -h : human-readable file sizes ● File hierarchy -d: show directories themselves, not ● Filesystems contents Files ❖ ls options -F : classify files with indicators ❖ ls -l ● ❖ Regular files ❖ Other file e.g., directory / , symlink @ , types ✦ ❖ File executable * permissions ❖ Changing file permissions 27 / 32

  28. ls -l Review $ ls -l lec04.lyx Users -rw-r--r-- 1 daradib daradib File hierarchy 15K Sep 24 16:38 lec04.lyx Filesystems Files file type ● ❖ ls options ❖ ls -l permissions: user, group, other ● ❖ Regular files ❖ Other file number of hard links ● types ❖ File owner, group, size, mtime, name ● permissions ❖ Changing file permissions 28 / 32

  29. Regular files Windows: filetype extensions Review ● Users .exe File hierarchy ✦ Filesystems .doc ✦ Files ❖ ls options Unix: magic tests ❖ ls -l ● ❖ Regular files ❖ Other file man file ✦ types ❖ File permissions ❖ Changing file permissions 29 / 32

  30. Other file types Review ls -l ● Users d irectories (dir) File hierarchy ✦ Filesystems symbolic l inks (symlink) ✦ Files devices: c haracter, b lock ✦ ❖ ls options ❖ ls -l s ockets, named p ipes (FIFOs) ✦ ❖ Regular files ❖ Other file types ❖ File permissions ❖ Changing file permissions 30 / 32

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend