JB

Standard File Hierarchies

Standard File Hierarchies

Introduction

  • Topic 2.3 focuses on the two most common standard file hierarchies: Microsoft Windows and POSIX (Linux).
  • These standards dictate the location of important files for the respective operating systems.
  • The standardization ensures that the OS and applications can locate essential libraries and data.
  • Standardized locations group similar data in known directories, simplifying the system.
  • Application developers know where to place and find ancillary components.
  • System administrators know where to look for log files and other critical data.
  • Even regular end-users benefit from knowing the standard locations of applications and configurations.

Microsoft Windows File Hierarchy

  • Users can explore the file system by opening the file browser and navigating to the C drive.
  • Key directories:
    • Program Files and Program Files (x86): Store executable system files and end-user applications.
      • 32-bit applications are stored in Program Files (x86) due to Windows' ability to emulate older architectures.
    • Users: Contains home directories/folders for user accounts on the Windows machine.
    • Windows: Contains all operating system resources.
      • Should be treated as read-only.
      • Subdirectories:
        • System32: Contains utilities and libraries.
        • System32\Drivers: Contains drivers for hardware devices.
    • Temp: Contains temporary files created by applications.
      • Files may persist after a reboot and can be cleaned by the OS or user.
  • Key differences from POSIX file systems:
    • Devices/hard disks are referenced by a letter followed by a colon (e.g., C:).
    • Paths are separated by backslashes (e.g., Windows\System32).
    • Other operating systems and web browsers use forward slashes in paths (URLs).

POSIX (Linux) File Hierarchy

  • POSIX systems are older than Windows and have evolved organically since the 1970s.
  • Backward compatibility is crucial, so the structure remains largely unchanged.
  • The root of the file system is denoted by a forward slash (/).
  • Any other mounted file systems reside within this hierarchy.
  • Key directories:
    • /home: User home directories (equivalent to the 'Users' directory in Windows).
    • /tmp: Temporary files.
    • /bin: Important system programs (binary files).
    • /sbin: Important system administration tools.
    • /var: Log files. Subdirectories exist for different services (e.g., web server logs).
    • /etc: System and program configuration files.
      • Configuration files are typically text files, unlike Windows, which uses a registry.
    • /usr: Executable programs, structured text, library files, and documentation used by end-users but not part of the core OS.
      • /usr/bin: Programs created/stored by users.
      • /usr/lib: Library files for user-oriented programs.
      • /usr/share: Documentation, including man pages.

POSIX File System Example

  • Demonstration of navigating the POSIX file system using a terminal.
  • Commands:
    • pwd: Present working directory. Displays the current directory.
    • cd: Change directory. Used to navigate the file system (cd / goes to the root directory).
    • ls: Lists files and directories in the current directory.
    • ls -l: Long listing, provides more information about files and directories (permissions, size, modification date, etc.).
    • tree: Displays the file system in a tree-like diagram.
      • tree -d -L 1: Restricts the output to directories only and limits the depth to one level below the current directory.
  • File types indicated in the long listing:
    • d: Directory.
    • l: Symbolic link.
    • -: Regular file.

Common Files in Linux Root Directories

  • /etc: Contains system and application configuration.
    • fstab: Table of file systems mounted at boot.
    • Password files.
    • Network information.
    • Time zone configuration.
  • /bin: Essential command binaries.
    • ls: Lists directory contents.

Additional Resources

  • Slide 33 lists additional references for learning more about standard file locations for Linux and macOS.