Standard Linux Directories Explained

Standard Linux Directories Explained

Table of Contents

  • /bin
  • /boot
  • /dev
  • /etc
  • /home
  • /lib
  • /media
  • /mnt
  • /opt
  • /proc
  • /root
  • /run
  • /sbin
  • /src
  • /sys
  • /tmp
  • /usr/bin
  • /usr/include
  • /usr/local
  • /usr/sbin
  • /usr/share
  • /usr/tmp
  • /var
  • /var/log
  • Bibliography

In this article, I will comprehensively discuss Linux directories and their contents. It is essential to understand the hierarchy and have a fundamental understanding of it.

Memorization is not necessary, but the better you understand, the easier it will be to work with different standard Linux directories.

/bin

/bin contains core operating system commands [Neme11]. Most of the programs are in binary format.

In a previous article, I discussed a few commands. Now, let's take a look at some program examples found inside the /bin directory:

  • /bin/ls: Used for listing directory contents.
  • /bin/cp: Used for copying files and directories.
  • /bin/mv: Used for moving files and directories.

/boot

The boot directory consists everything required for the boot process.

This directory stores data that is used before the kernel beings executing user-mode programs [Ng04].

/dev

Contains device files including entries for disks, printers, etc. For example, /dev/sda represents the first hard disk drive.

/etc

The /etc directory contains critical startup and configuration files.

/home

/home is the default home directories for users.

/lib

Contains libraries, shared libraries, and commands used by /bin and /sbin [Neme11]. Windows equivalent to a shared library would be a DLL file.

/media

This directory is used for "mount point" for removable media. For instance, CD-ROMs, floppy disks, et cetera.

/mnt

Moreover, /mnt is used for temporary mounting.

/opt

This directory is reserved for all the software packages that are not part of the default OS installation [Ng04].

/proc

The /proc directory holds information about all running processes.

/root

This is the home directory of the superuser.
Most represented by /.

/run

This directory is a rendezvous points for running programs (PIDs, sockets, etc.) [Neme11]

/sbin

System binaries.

Utilities used for system administration and other root-only commands are stored in /sbin, /usr/sbin, and /usr/local/sbin.

The directory includes binaries essential for booting, restoring, recovering, and/or repairing the system in addition to the binaries in /bin [lf24].

/srv

Files held for distribution through web or other servers [Neme11].

For instance, it's consider a good practice to include the website data inside /srv directory (while using HTTP server).

/sys

The /sys is the location where information about devices, drivers, and some kernel features is exposed [lf24].

/tmp

The /tmp directory is used for temporary files and files inside will be erased between reboots.

/usr

The /usr directory is one of the most important directory in Linux because it holds all the necessary user binaries.

/usr/bin

Most commands and executable files belongs to this directory [Neme11]. For example, vi, gcc, gnome-session, and so forth.

/usr/include

This directory is for 'Header files'; for compiling C programs.

/usr/local

Local software or configuration data; mirrors /usr. According to [Ng04],
this directory is widely regarded as a good place in which to keep self-compiled or third-party programs. Futhermore, the hierarchy is for used by the system administrator when installing software locally.

/usr/sbin

For less important commands for administration and repair, mean to be run by root.

/usr/share

Contains items that might be common to other system, for e.g., docs, icons, fonts, et cetera.

/usr/tmp

For more user space temporary files.

/var

Contains system-specific data and a few configuration files [Neme11].

/var/log

For system log files.

Articles recommended by the author

Bibliography

[Neme11] E. Nemeth, UNIX and Linux System Administration Handbook. Prentice Hall, 2011. [Online]. Available: https://books.google.de/books?id=0SIdBAAAQBAJ

[Ng04] B. Nguyen, Linux Filesystem Hierarchy, 2004. [Online]. https://tldp.org/LDP/Linux-Filesystem-Hierarchy/html/

[lf24] linuxfoundation.org. [Online]. Available: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s16.html

Leave a Reply

Your email address will not be published. Required fields are marked *


© 2024 A. Maharjan