Understanding the Linux Directory

The layout

A quick ‘ls‘ command will show you the directory structure of any linux system. Just go to the root directory, ‘cd /‘ and type ‘ls’. In my current system, Ubuntu 8.10 I have:



Bin contains the system binary files that are essential for general operation of your computer. These exectuable files are the next line after the system kernel. Withtout these you can’t do a whole lot of anything on your computer. Some of these include:

  • cp – Copy files to and from
  • ls – Get a directory listing, remember we used this above
  • bash – A popular Linux CLI (shell)


If you are used to other operating systems this will be weird for you. As everything in Linux devices are represented as a directory. This makes it easier for other programs to interact with them. For example mount.

You can use the system binary mount in the /bin folder to interact with a removable hard drive for example.


If you have a system crash and the Linux file system checker (fsck) recovers corrupt files they are placed here.


Opt is reserved for additional software you install; although, most providers don’t use it. This is kind of like ‘Program Files‘ for linux.


Sbin is similar to /bin with the exception that these ready to run binaries are reserved for root users. That is they typically will only work when executed by root or sudo. Examples would include:

  • mke2fs
  • ifconfig
  • fdisk


Tmp is a temporary storage folder. Anything that is to be temporarily stored goes here. It is recommended that you don’t delete these manually. If you want to delete them you usually add this to boot up or shutdown procedure since they can contain useful information for programs that are already running.


This folder contains only the files that are absolutely necessary to get a basic Linux system up and going. This folder is not used for programs to run on startup or other user scripts. This folder usually contains Grub information and the Linux kernel.


This folder is the config folder for your entire operating system. Almost everything about configuring your system can be done in here. The general rule of thumb is that these files are static and text based. No binaries should be placed in this folder.

Common config files in here are:

  • /etc/X11 – For configuring X (gui)
  • /etc/apt/sources.list – Configuring apt for Debian based systems
  • /etc/cups – Printer configuration
  • /etc/fstab – Device mounting
  • /etc/httpd – Apache webserver


Traditionally all mounts were stored in the /mnt directory but out of controversy of where to stored removable mounts this directory was born. /media should be used to store mounts for removable devices only, like:

  • CD-Rom
  • DVD-Rom
  • Floppy
  • Flash Disks


Proc is a special virtual directory like /dev that contains process information. It contains runtime system info like: system memory, devices mounted, hardware configuration, etc.


Srv is a serve folder. It holds site specific data to be served by the system for protocols such as, ftp, rsync, www, cvs etc. To be compliant distributions include this folder but I have not seen it used much.


Usr houses all the binaries, documentation, libraries, and header files for all the user applications. Most user binaries will be installed into this folder making this one of the largest folders in the Linux directory.


CD-Roms can be mounted to this folder but it is not in the official Linux Filesystem Hierarchy. CD-Roms should be mounted under /media.


Home is where you will store all user specific documents and settings. This is similar to Windows, “Documents and Settings”. On most Linux distributions /home will contain a directory with each user’s name or group of users. e.g. /home/mark /home/guests.


Lib contains system library binaries that are required to run the system. In Windows this would be the system folder with .dlls. Only in Linux it is represented by ‘.so‘.


According to FSSTND version 2.3, ” This directory is provided so that the system administrator may temporarily mount a filesystem as needed. The content of this directory is a local issue and should not affect the manner in which any program is run.”

I think of this directory as the place to mount fixed hard drives that I mount with the fstab file, but as described in FSSTND it is primarily for temporary mounts.


Root is the “home” directory for root. If this directory doesn’t exist it defaults back to ‘/’. Hence the username root.


This is kinda like /proc it is used for plug and play configuration.


This stands for variable. This stores all the files that vary as the system runs. Things like log files, backups, mail, cache, etc..


So there you have it a quick layout of the Linux system. If you have any further questions you can consult the official Filesystem Hierarchy Standard (FHS) or comment below.

Subscribe via Email

Subscribe to Nixtutor via Email

Enter your email address:

Was this information useful?

29 Responses

  1. Richard Kut


    Great explanation for newbies and veterans alike! Thank you!

  2. Mark Sanborn


    Thanks Richard. :)

  3. Roon


    Great guide, will recommend this so some of my mates who are continually asking me what all the linux directories are for!

  4. blargh


    great explanation. i used linux for 2 years now, but i could never remember the uses of the different folders. this clears it up a bit.

  5. Werner


    As far as I know, the lost+found directory is used by the ext2, ext3 filesystems to store lost inode and file information.

  6. fred


    Wow, this is exactly what I’ve been needing. Thank you!

  7. penguin007


    Do in a terminal:

    man hier

    It will give you far more detail on the hierarchy

  8. GoremanX


    Informative article! A lot of users new to Linux (and even some not-so-new ones) will find it very useful. Just a couple of clarifications:

    lost+found is where the ext2/ext3 (and maybe ext4, not sure) place files that were recovered during an fsck operation (linux version of scandisk). It’s a directory that’s specific to those filesystems only. It’s created when you format a partition as ext2/ext3. If you format as XFS, ReiserFS, JFS or many other filesystems, the lost+found directory is not created at all. It does not exist in my / directory because I use XFS, but it does exist in my /boot directory because I mount that as a separate ext2 partition.

    /mnt is considered a “temporary” mounting location because it should not include system files that are needed for proper operation of the system, not because things that are mounted there have a limited lifespan. I use /mnt to mount my NFS shares via autofs, and then each user has appropriate symbolic links in his/her /home directory to these mounts to access the data they offer.

  9. Mark Sanborn


    Werner and GoremanX are correct, I fixed the article to reflect these changes.

    Thanks for the input and comments all.

  10. Mike


    Excellent article!!!

  11. gus3


    Another important fact about lost+found/ is that its dnode is pre-allocated when the filesystem is created. This way, a lost inode can be attached with one write into that pre-allocated space, without needing to alter the block bitmaps (barring thousands of lost inodes).

  12. gus3


    gah… forgot the most important point.

    The 3 pre-allocated blocks for lost+found/ disappear if you “rmdir lost+found” and then “mkdir lost+found”; the new allocation will be just 1 block. Best to leave it alone; three blocks out of billions won’t hurt things, and it will certainly help when it’s needed.

  13. Deepak


    Nice article. It is always a confusion what all the dir meant every time. This clears a lot :)

  14. logicalmind


    Good article, but I have always wondered….what does “etc” stand for? Is it etcetera? Is it an acronym where the “c” stand for configuration? I’ve always wondered…

  15. Mark Sanborn


    It is either etcetera or I like to think of it as, “Editable Text Configuration”

  16. Phil Q


    The entry about the /dev directory is not correct. The devices are not directories as stated but ‘special’ files created with the ‘mknod’ command, either by hand or the ‘udev’ daemon. These are either character or block devices as appropriate, e.g. a serial port is a character device and a disk is a block device.

    What is important about these is the so called major and minor number (visible with ls -l). When the device file is opened the kernel routes the request to the registered driver (see output of /proc/devices) for the major number, passing the minor number as well. The name of the file does not actually matter, that is for the user’s convenience.

  17. Bendo


    Thanks, however why not take it a bit further.
    i’ve always wondered what /bin, /usr/bin or /usr/local/bin etc. why all the bin areas? and there are other places where directories are named the same but in different places. That would be good to know why all these different areas.
    Thanks again.

  18. Govi


    enebody explain how to recover through lost+found directory

  19. [...] helpful to know what hard drives are connected to a system and what name was given them in the Linux directory. This info allows us to mount the hard drive and manipulate it. sudo fdisk [...]

  20. Mocabilly


    Isn’t the /sbin directory for system binaries?
    I think putting it like it would only contain binaries that the root user can execute is a wrong..

  21. Mark Sanborn


    It is for system binaries and other binaries for root only.

  22. CB


    Thanks for that. Have bookmarked you.
    One vital piece of information is missing – maybe somebody can help: How do you PRONOUNCE etc, srv and mnt?

    I always called etc ‘etcetera’ but my friend says ‘ett-kih’. There must be some kind of old-schooler convention about this.

    This is mostly an amusing question – but a real one nonetheless: when chatting with another nix-using friend about a problem or configuration I always have a stumble or ‘needing-to-think-twice’ moment when referring to the directories.

    I noticed that SUSE used the opt directory a lot.

  23. Mark Sanborn


    Well srv is the serve directory so I would just say serve or S.R.V. etc can be pronounced many aways, some thing of it as editable text configuration. I personally pronounce it as etcetera. Some say ett see

  24. [...] In almost all Linux distributions the Linux log files are stored in ‘/var/log‘ directory. You can learn more about Linux directory structure in this article. [...]

  25. [...] non-system,  binary file and therefore may be installed in the /opt folder in accordance with the Filesystem Hierarchy Standard. Open up a terminal [...]

  26. Jestin Joy


    Good work. Thanks for the info

  27. Srinivas N


    Dude,, this is a good start for newbie..thanks a lot..

  28. Yang


    Seems this is the first entry. And I’ll read till the newest one.

    Here I go…..

  29. glbeach


    Nicely done, thank you.