Categories
Linux Tutorial Series

Linux Tutorial Series – 20 – Linux directory hierarchy

Here is the video version, if you prefer it:

In this article, let’s talk about the Linux directory hierarchy. Here is how it looks like:


Figure 1 – Linux directory hierarchy (modeled after Figure in (Ward, 2014)⁠, page 40)

Here is a description of each of the directories: (Ward, 2014)⁠ (Barrett, 2016)

  • bin/ – programs (executables) you run in the shell are located here
  • boot/ – files for booting the system
  • dev/ – device files (your hardware devices represented as files)
  • etc/ – configuration files for your system
  • home/ – personal directories of all of the users
  • lib/ – files needed to successfully run some programs (those files are also known as libraries)
  • lost+found/ – damaged files that were recovered by a disk recovery tool⁠
  • media/ – files that enable access to disks
  • mnt/ – files that enable access to disks
  • opt/ – packages you might have paid extra money for (“What does ‘opt’ mean (as in the ‘opt’ directory)? Is it an abbreviation?,” n.d.)⁠
  • proc/ – operating system statistics
  • run/ – cross-distribution location for the storage of files that do not require preserving across reboots (system restarts); this is very complicated to read – I would read that as “files that can evaporate after every reboot” (“RunDirectory,” n.d.)⁠
  • sbin/ – place for system executables (only the superuser can run these)
  • srv/ – “This main purpose of specifying this is so that users may find the location of the data files for particular service, and so that services which require a single tree for readonly data, writable data and scripts (such as cgi scripts) can be reasonably placed.” (“1.19. /srv,” n.d.)⁠
  • sys/ – provides device and system interface
  • tmp/ – temporary files
  • usr/ – system files
  • var/ – program runtime information

That’s pretty much it. Within those directories you may have subdirectories, which have their own meanings, but this article should give you the “one layer deep” explanation of what is going on. If you need additional explanation of a particular directory, use Google. I have found it useful to remember the general layout of what is where as I have described above, but if I ever find myself in need of the specifics of some particular directory or subdirectory I Google it.

Hope this helped!

References

1.19. /srv. (n.d.). Retrieved December 22, 2019, from https://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/srv.html

Barrett, D. J. (2016). Linux pocket guide (3rd ed.). O’Reilly Media. Pages 21-23

RunDirectory. (n.d.). Retrieved December 22, 2019, from https://wiki.debian.org/ReleaseGoals/RunDirectory#A.2Frun

Ward, B. (2014). How Linux Works: What Every Superuser Should Know (2nd ed.). No Starch Press. Pages 40-42

What does “opt” mean (as in the “opt” directory)? Is it an abbreviation? (n.d.). Retrieved December 22, 2019, from https://stackoverflow.com/questions/12649355/what-does-opt-mean-as-in-the-opt-directory-is-it-an-abbreviation

NewsletterUpdates on interesting things I am doing

Subscribe to my newsletter to keep abreast of the interesting things I'm doing. I will send you the newsletter only when there is something interesting. This means 0% spam, 100% interesting content.

Leave a Reply

Your email address will not be published.