Part Workbook 5. the Linux Filesystem Table of Contents
Total Page:16
File Type:pdf, Size:1020Kb
Part Workbook 5. The Linux Filesystem Table of Contents 1. File Details ................................................................................................................... 5 Discussion .............................................................................................................. 5 How Linux Save Files ...................................................................................... 5 What's in an inode? .......................................................................................... 6 Viewing inode information with the stat command ................................................. 9 Viewing inode information with the ls command .................................................. 10 Identifying Files by Inode ................................................................................ 10 Examples .............................................................................................................. 11 Example 1. Comparing file sizes with ls -s and ls -l ............................................... 11 Example 2. Listing files, sorted by modify time ..................................................... 11 Example 3. Decorating listings with ls -F ............................................................. 12 Online Exercises .................................................................................................... 13 Online Exercise 1. Viewing file metadata ............................................................. 13 Specification .......................................................................................... 13 Deliverables ........................................................................................... 13 Suggestions ........................................................................................... 13 Questions .............................................................................................................. 13 2. Hard and Soft Links ..................................................................................................... 17 Discussion ............................................................................................................. 17 The Case for Hard Links ................................................................................. 17 Hard Link Details ........................................................................................... 17 The Case for Soft Links .................................................................................. 19 Soft Link Details ............................................................................................ 20 Creating Links with the ln Command ................................................................. 20 Issues with Soft Links ..................................................................................... 21 Dangling Links ...................................................................................... 21 Recursive links ....................................................................................... 22 Absolute vs. Relative Soft Links ............................................................... 23 Comparing Hard and Soft Links ........................................................................ 23 Examples .............................................................................................................. 23 Example 1. Working with hard links ................................................................... 23 Example 2. Working with soft links .................................................................... 24 Example 3. Working with soft links and directories ................................................ 25 Online Exercises .................................................................................................... 25 Online Exercise 1. Creating and Managing Links ................................................... 25 Specification .......................................................................................... 25 Deliverables ........................................................................................... 26 Online Exercise 2. Sharing a Hard Linked File ...................................................... 26 Specification .......................................................................................... 26 Deliverables ........................................................................................... 27 Questions .............................................................................................................. 27 3. Directories and Device Nodes ........................................................................................ 30 Discussion ............................................................................................................. 30 Directories ..................................................................................................... 30 Directory Structure ................................................................................. 30 Directory Links ...................................................................................... 31 Device Nodes ................................................................................................ 33 Block and Character Device Nodes ............................................................ 33 Terminals as Devices .............................................................................. 34 Device Permissions, Security, and the Console User ...................................... 35 Examples .............................................................................................................. 36 2 The Linux Filesystem Example 1. Interpreting Directory Links Counts .................................................... 36 Questions .............................................................................................................. 37 4. Disks, Filesystems, and Mounting ................................................................................... 40 Discussion ............................................................................................................. 40 Disk Devices ................................................................................................. 40 Low Level Access to Drives ............................................................................. 41 Filesystems .................................................................................................... 42 Mounting Filesystems ...................................................................................... 43 Viewing Mount Points ............................................................................. 44 Why Bother? ......................................................................................... 44 Mounting Temporary Media: The /media directory. ....................................... 45 Mounting Issues ..................................................................................... 46 Examples .............................................................................................................. 47 Example 1. Using an Unformatted Floppy ............................................................ 47 Example 2. Using a DOS Formatted Floppy ......................................................... 48 Example 3. Floppy Images ................................................................................ 49 Online Exercises .................................................................................................... 49 Online Exercise 1. Using Floppies ...................................................................... 49 Setup .................................................................................................... 49 Specification .......................................................................................... 50 Deliverables ........................................................................................... 50 Possible Solution .................................................................................... 50 Cleaning Up .......................................................................................... 50 Online Exercise 2. Imaging a Floppy ................................................................... 50 Setup .................................................................................................... 51 Specification .......................................................................................... 51 Deliverables ........................................................................................... 51 Possible Solution .................................................................................... 51 Cleaning Up .......................................................................................... 51 Questions .............................................................................................................. 51 5. Locating Files with locate and find ................................................................................. 55 Discussion ............................................................................................................. 55 Locating Files ................................................................................................ 55 Using Locate ................................................................................................. 55 Using find ....................................................................................................