Linux Directory Structure

The Linux directory structure is confusing at first but there is organization amid the confusion. It is actually loosely structured and the directories/subdirectories follow a basic logic. Linux is open source and there have been and always will be liberties taken in the organization of the directory structure. Here's my take on the basic directory structure and the contents:

/ - Root Directory

The root directory is the top layer of the filing system. All other directories are connected to it.


The /boot directory contains the files required to boot the system. The kernel(s) resides in this directory and typically there is a subdirectory for the boot loader: /boot/grub. The grub boot loader allows you to select between multiple kernels at boot time if needed. It's pretty nice as you can test out different kernels while still being able to boot to the original kernel.


The /etc directory holds the configuration files for most if not all of the startup and system processes, applications and daemons running on the computer. There are many subdirectories dedicated to a specific applications like apache or the boot-up processes like the hard-drive filesystem or init.d. The vast majority of the configuration files are text files that you can edit manually using a test editor or through a GUI. One very nice thing is that if your graphical user interface (X windows) doesn't work for whatever reason, you can still manually edit the files to fix what's broken.


The /bin directory holds binaries (applications) specific to the operating system that the user would access. Examples of these are the grep, netstat, demsg, dir, ls, more, etc.. These are considered programs that examine the system but can't hurt it.


The /sbin directory holds binaries (applications) specific to the operating system that the root user (administrator) would access. Examples of these are the mkswap, format, ifconfig, etc.. These are considered programs that can modify the system and can damage the system if used incorrectly.


The /lib directory holds the libraries and subdirectory libraries related to the operating system uses. Typically libraries filenames start with the letters lib and version numbers such as The applications will call-up these libraries when needed. For example: "the library's purpose is to provide a consistant and stable interface for querying system device information exposed through sysfs". There subdirectories for various system level functions like /lib/linux-sound-base or /lib/modules


The /usr directory contains applications and application subdirectories that the usr would use. These are where the programs such as the Firefox web browser, LibreOffice or games are located. Typically, the subdirectory structure mimics the / (root) directory with a few differences:

  • /usr/etc

    The /usr/etc subdirectory contains the configuration files unique to the user applications. Often there are subdirectories containing specific applilcation configuration files for all users. Specific configuration files for individual users may reside in the user's home directory under a hidden subdirectory like .gftp or .filezilla. Files and directories starting with a . (period) are hidden from normal view.

  • /usr/bin

    The /usr/bin subdirectory contains user applications such as the VoIP softphone zoiper or the xscreensaver program. These are programs that all users would use to modify their environment or applications.

  • /usr/sbin

    The /usr/sbin subdirectory contains applications that alter the user environment and can damage the user environment. Normally, you need a higher level of permission like root or be a member of a special group to access these binaries. Examples of these binaries are logrotate, mysqld and useradd.

  • /usr/lib

    The /usr/sbin subdirectory contains the libraries and library subdirectories that the user applications would call. These libraries support the user programs and examples are libgnomeprint, libjavascript and libgnome-desktop. Examples of subdirectories would be the Wireshark, openssh and nvidia subdirectories.

  • /usr/src

    The /usr/src subdirectory contains source files (code) for programs that are compiled. Normally, the Linux kernel source code resides in this subdirectory. You can compile the kernel to be specific for your purposes. Once an application is compiled, it is moved (installed) into one of the bin, sbin or lib directories where applications are normally run from. I like to download the compressed archives into this subdirectory, then uncompress them, configure the source code the way I want then compile the code using the "make" command then install the application using the "make install" command. I end up with a pretty clean system that way and always have the original source code to modify if I screw up.

  • /usr/local

    The /usr/local subdirectory contains the actual user programs that are used such as text editors, games and programming languages like perl, php or ruby. It also has a subdirectory structure similar to /usr and includes subdirectories for the man pages and documentation.

  • /usr/share

    The /usr/share subdirectory contains the applications that are shared across all users. These are applications like the GUI interface, screen resolution, language packs, java, usb, etc..

  • /usr/include

    The /usr/include subdirectory contains Include files. Many C programs have #include statements. This subdirectory contains the files referenced by those statements. Typically the files end with ".h". Examples are math.h, regex.h and langinfo.h


The /dev directory contains the devices found on the computer. The devices are the the keyboard, hard-drive, ram, cpu, IRQs, etc.. You must be the root user to access these files as you can easily damage the operating system and computer if you don't know what you are doing.


The /var directory is an interesting directory that holds files that the system writes to as it operates. An example of what might be in the /var directory is the /var/log directory. Applications, programming languages and the operating system write their log files in /var/log. Also there will be subdirectories for print spoolers, caches and lock files. Strangely, it has become standard for the apache webserver to locate its webpages om the /var/www subdirectory.


The /lost+found directory to put it simply will contain the results of an attempted recovery from a system crash. If a computer running Linux is not shutdown properly or crashed, on the next boot-up, the fsck program will go through the system and try to recover any corrupt files that it finds. The result of this recovery operation will be placed in the /lost+found directory. There may be some important lost data recovered sitting there.


The /mnt directory typically contains the removable disks and drives such as USB drives, CD ROMS, DVD drives, floppy disks, etc.. Each physical drive is mounted into a subdirectory of the /mnt directory such as /floppy or /cdrom. When a device is not needed, the device is unmounted from the subdirectory. Typically, you must unmount a device before it will eject. This makes sure that the filing system has completed writing to the device and it is safe to remove the media.


The /tmp directory is used to hold temporary files that the operating system, process or an application uses while it is running. Once the process or application stops, the temporary files are deleted.


The /proc directory contains the dynamic processes that are running on the computer. Linx is pretty neat as all processes are treated as subdirectories containing text files. You can quickly find out what IRQs are used and to which cpu the IRQ is assigned to by using the following command: "cat /proc/interrupts". The "cat" program just lists the contents of a text file.


The /opt directory is supposed to hold all applications that are not part of the base Linux installation. In fact, few applications follow this rule. Most end up somewhere in the /usr directory. Examples of applications that you will find here are Firefox, java and Adobe. I have only 5 apps that follow this rule on my system. Sometimes getting open source programmers and developers to follow rules like this one is as successful as herding cats.


One of the most confusing directories is the /root directory. What the heck is with that? There already is a "/" root directory. The /root directory is the home directory of the Linux system administrator named root. The root user has a separate directory from all other users. This is because the root user must be able to log onto the computer or server. Under Linux, directories can be linked through the network to other computers such as the /home directory. If the link broke, the root user would still be able to log on the computer.


The /home directory contains all of the user's home directories. The user's home directories are subdirectories under the /home directory and are named after their user account. The user blanchae would have a home directory located at /home/blanchae. Programs like ftp have home directories also. The ftp home directory resides at /home/ftp. This is the subdirectory where external ftp users share their files.

If this page has helped you, please consider donating $1.00 to support the cost of hosting this site, thanks.

Return to

TelecomWorld 101

Copyright July 2013 Eugene Blanchard