Get to Know Linux: File System Hierarchy

Jack Wallen
Dec 11, 2008
Updated • Jan 4, 2013

The Linux file system hierarchy is much different than that of Windows. So much so that it becomes a show stopper for many new users. I hope to clear up a lot of the confusion here and now at gHacks. So, without further adieu, I give you the Linux file system hierarchy.

/ - This is the base, or root, of the file system. Everything in the Linux system is housed in this directory.

/bin - This directory contains a number of essential commands that are available to unprivileged users (such as cat, chmod, chown, etc). The /bin directory also houses the shells (such as bash).

/boot - This directory contains everything necessary for the boot process. Without the /boot directory, your machine would not be able to boot up.

/dev - This directory contains all of the special and device files. With Linux all devices and drives have a name. Hard drives tend be labeled as hda, hdb, hdc. Special devices such as external usb devices can be labeled as sda, sdb, sdc.  If you look in the /dev directory you will see quite a few files that can be associated with devices. Most of the devices found here are either block or character devices. Block devices hold data (such as a hard drive) and character devices transmit data (such as a mouse).

/etc - This is a very special directory that contains numerous configuration files and directories. This directory will contain the X configurations, Apache, Samba, the init system, etc. The /etc directory also houses the sources for package management systems like apt and yum. One of the most important subdirectoris in /etc is the /etc/init.d (or in Red Hat based systems, /etc/rc.d/init.d). This subdirectory contains all of the initialization scripts for services such as networking, samba, apache, cron, hal, etc.

/home - This is where all user data is housed. Each user on the system will have their own subdirectory within /home. All user data and user-specific configuration files are saved here.

/lib - This is where all kernel modules needed for system boot libraries that are required by root system commands (commands found in /bin and /sbin.)

/lost+found - If your system crashes or is shut down improperly any lost data will be stored here. During a recovery boot the fsck application will attempt to recover corrupt files found here.

/media - This is where all external media (or extra internal drives) is mounted. If you make or edit entries in the /etc/fstab file you will point devices (such as /dev/sda to directories withing /media.)

/mnt - This is another directory where external (and internal) drives and devices are mounted. This is a holdover to older school thought. Most modern distributions are moving to the /media directory.

/opt - This is a directory that can be used for installing applications that are outside of the default installation. When you install applications here they can be used system wide by all users. Only the root user can install applications here.

/proc - This is a special directory that is actually a virtual filesystem. The /proc directory acts as a process information center for the kernel.

/root - This is the root users home directory.

/sbin - This is where all system maintenance/administration executable files are stored. These commands differ from those in /usr/sbin in that they are system commands used for critical system administration and maintenance whereas /usr/sbin are non-critical tasks such as user administration, network administration, etc.

/usr - This is one of the largest directories on your system as it contains all user-executable binaries as well as the libraries, documentation, and header files for these executables. One of the most important subdirectories is /usr/bin where all user application executables are stored.

/var - This directory contains all variable data such as log files. On a server environment the document root directory of most servers will be found here (/var/www and /var/ftp are examples.)

/srv - This directory can contain the services (such as www) directory in some distributions.

/tmp - This directory, as you would expect, contains temporary files that are stored as needed. Many files you will find here are lock files created by applications. Do not remove anything from this directory as the cron system has a job specifically created for the removal of these files.

And there you have it. A description of each directory in the Linux file system hierarchy.


Previous Post: «
Next Post: «


  1. max said on March 4, 2013 at 11:53 pm

    good content

  2. fromtheyard said on December 14, 2008 at 9:29 pm

    just a reminder…in opensuse, the /home folder is usually situated on a different partition as a security measure.

    .wine folder stores your windows applications if you have installed any.

  3. Dotan Cohen said on December 12, 2008 at 4:46 pm

    Do regular end users really need to know this stuff? I think that knowing what /home and /media are is enough. Does the typical Windows user know or care what is in sys32?

  4. mickay said on December 12, 2008 at 11:53 am

    Really great job, Jack. I’m looking forward for more articles of yours.

  5. garbanzo said on December 12, 2008 at 10:07 am

    i have not had time to read these linux posts yet, but this weekend i’m going to start compiling them into a PDF. i know absolutely nothing about linux, so i’m very grateful for these posts. thanks jack!

  6. Genisis said on December 12, 2008 at 6:17 am

    Copied, Pasted, Saved! Thanks a Million and keep the posts coming!

  7. gokudomatic said on December 12, 2008 at 12:28 am

    really nice. thanks. but as a privileged user, where should I install a software only for me without using root? I suppose /usr, but how should it be structured? That was always one of the biggest questions I was wondering when I was running linux : where are the user apps? where are the conf files? where are the doc?
    And as a developer, like in java, how should I create an installer? I have no idea.

  8. iampriteshdesai said on December 11, 2008 at 10:38 pm

    Uber Sexy :P
    Keep Up The Good Work

  9. Paul. said on December 11, 2008 at 9:45 pm

    Great i hope you will keep up the good work and go on explaning just as christal clear as you dit up to now.

  10. my-t-man said on December 11, 2008 at 9:43 pm

    First I want to thank you for answering my questions yesterday. Second, I can’t tell you how much I appreciated todays post. I never could seem to find all this in one place before. I will be looking forward to more of your help. Thank you once again.

  11. RG said on December 11, 2008 at 9:24 pm

    Thank you, this is print worthy. After a while of writing these articles you should compile them and make a Ghacks Linux book :)

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.