This post does not intend to provide comprehensive information on how to pass the certification, but serves as study notes on better understanding Linux system. linux_directory_structure.png Even though I have used Linux for quite sometimes now, I never systematically learn how its components works. One of the issues that I often run into is that I don’t know where are the files, say I want to look at the log of the web services, I don’t know where they’re and I’ve to look it up on the internet. I think it’s time I take a systematically approach on better understanding the system.

The Linux directory follows the Filesystem Hierarchy Standard(FHS). A high-level overview of the well-known directory:

  • / (root): the top-level directory of the system
  • /etc: stands for extended text configuration, contains local system configuration files
  • /opt: holds additional programs
  • /usr: contains read-only files
    • /usr/bin: binary directory that contains user executable commands
    • /usr/sbin: system binary directory, commands that are required at system boot or root user privileges.
    • /usr/lib and /usr/lib64: contain shared library
    • /usr/local: serves as the repository for third-party applications and commands
    • /usr/share: contains manual pages, documentation, sample templates, and configuration files
    • /usr/src: contains source codes
  • /var: contains variable files that are frequently changed
    • /var/log: contains most system logs files, such as user logs
    • /var/opt: contains logs for programs installed in /opt
    • /var/spool: contains queue items that are being sent out, such as print jobs, cron jobs
    • /var/tmp: contains temporary files, removed if not accessed or modified for 30 days.
  • /tmp: contains temporary files, removed if not accessed or modified for 10 days.
  • /dev: contains files that represent physical hardware or virtual devices

Apart from above, there are also something called Virtual filesystems, which made easy to implement different file systems because it abstracts lower layers. Some command examples are:

  • /proc: provides the current state of the kernel, as well as hardware configuration and status
  • /sys: provides information about hardware devices, drivers
  • /run/media: used to mount external file systems such as flash drives