Pinterest Stumbleupon Whatsapp
Ads by Google

Open a file manager on your Linux box and select Computer in the sidebar. This will show your system folders. Do you have any idea what each of them hold? Some seem obvious. Others, not so much. And there isn’t a C: or D: drive in sight.

LinuxFilesystem-Root

Don’t fret. Here’s a breakdown of what makes your computer tick.

/bin & /sbin

The /bin folder holds many of binaries running on your machine. When you type a command into the terminal 9 Quirky Linux Commands You Need to Know (And Will Love) 9 Quirky Linux Commands You Need to Know (And Will Love) Make ASCII art, talk to your computer and play text adventures. Your Linux command line isn't just for work: it can be weirdly entertaining, if you know the right commands. Read More , this is the folder you’re searching through. To launch a program that isn’t in this folder, you will have to cd to that location instead.

LinuxFilesystem-Bin

/sbin holds binaries reserved for system administrators. These are the commands that normal users may not need to access.

Ads by Google

/boot

These are the files that your computer needs to boot. This is where your bootloader and the Linux kernel The Linux Kernel: An Explanation In Layman's Terms The Linux Kernel: An Explanation In Layman's Terms There is only one de facto thing that Linux distributions have in common: the Linux kernel. But while it's often talked about, a lot of people don't really know exactly what it does. Read More live. Needless to say, the stuff in here is essential. Screwing around in here can cause your computer not to start. You will want to know what you’re doing.

/dev

This folder’s name is short for device, not developer. Here you find files related to the hardware in your machine, such as the CPU and various hard drives.

Unix systems treat everything as a file, even when they aren’t. The “fake” files in /dev won’t make sense to your average user, but they make life easier for developers.

/etc

This began as a place to dump files that didn’t have a home. Now you will find start-up scripts and configuration files for your applications. If you want to edit which users have sudo privileges, for example, the configuration file is here.

LinuxFilesystem-Etc

These are system settings. Those that vary with each user are hiding in their home directories. You can often see those folders by pressing Ctrl + H (GNOME) or Alt + . (KDE).

/home

Each user gets their own directory. This is the space you’ve already familiar with. Here you see your documents, music, videos, and other content you see in your file manager Thunar vs. Nautilus: Two Lightweight File Managers For Linux Thunar vs. Nautilus: Two Lightweight File Managers For Linux Is Thunar a better file manager than Gnome's default, Nautilus? Read More .

/lib & /lib64

This location holds library images that your computer needs to boot plus kernel modules. The contents of this folder also enable you to run commands in a root environment. In short, important stuff.

/media

As mentioned earlier, Linux treats everything as a file, including devices. Like /dev, this folder contains files corresponding to hardware. In this case, it’s removable media like flash drives and CD roms.

/mnt

This is the directory for temporarily mounting drives. Think ISO images. Older Linux systems put more demand on the /mnt directory. These days many temporary mounts, such as loading an external hard drive, use /media.

/opt

The name is short for optional. This is a space third-party software can use, such as Java or Google Chrome.

/proc

Here you will find information about currently running processes. These “fake” files don’t actually take up disk space. But like the contents of /dev and /media, they look real.

LinuxFilesystem-Proc

These folders give information on your computer’s hardware and the kernel. /proc/cpuinfo provides details about your CPU, for example. You may want to let a system monitor access these files How to Kill Programs and Check System Information in Linux How to Kill Programs and Check System Information in Linux In Windows, unresponsive programs can be closed by hitting CTRL+ALT+DEL and opening the task manager. But in Linux, things are different. Fortunately, it's still easy to monitor and close unresponsive programs... Read More rather than view them directly.

/root

When you sign in as the root user, you have a separate home directory. This is it. Note, /root is different from /, which is also referred to as your root directory.

/run

There are some directories you would not have encountered a decade or two ago. This is one of them. It started to appear in 2011.

Some programs that run early during the boot process placed runtime data under /dev and other locations. This directory provides a dedicated space for this.

/srv

These letters stands for service, specifically those that you serve through your machine. Don’t be surprised to see nothing in this folder if you aren’t using your machine as a server.

/sys

This directory is a virtual filesystem. It displays information related to kernel subsystems, hardware devices, and associated device drivers. This area of your computer is a product of sysfs.

LinuxFilesystem-Sys

/tmp

Unsurprisingly, this folder contains temporary files. Here you may find ZIP files from programs and crash logs that won’t stick around. In the past, hard drives were small. Now we have more space than we need 5 Simple Ways to Save Money on New Hard Drives 5 Simple Ways to Save Money on New Hard Drives We’ve already covered all the things you need to consider to buy the right hard drive. Now it's about saving as much money as you can. Read More , but that doesn’t mean every bit of data needs to stick around forever.

/usr

User-facing applications and tools appear in this directory. Here you can find binaries, source code, icons, documentation, and other useful data.

/var

This space contains variable data. This is the spot for system logs, printer spools, lock files, and similar files. You may see cached data and folders specific to games. /var is separate from /usr for times when the latter is read-only.

If Only There Were an Easier Way to Remember This

There is. The image below provides an overview of each folder (except for /run). It’s available over at TecMint, along with more detailed information for those of you who need it.

LinuxFilesystem-Directory

What Were They Thinking?

As Linux Voice says in its July 2016 issue, “the secret to understanding the quirks of the Linux filesystem is to put yourself in the mind of a 1980s Unix system administrator.”

I was never a sysadmin in the 80s, nor was I alive. But I agree that it helps to try and get inside one’s head.

If you were a Linux administrator way back when, I’d love to hear your thoughts. Enlighten us younger whippersnappers in the comments!

As for everyone else, how often do you dive into the root directory? Do you find the folder hierachy confusing? How does it compare to other operating systems? Chime in!

  1. Marty Monroe
    July 7, 2016 at 7:39 am

    fsck, the filesystem check and repair command, might find data that looks like a file but doesn't have a name on the system — an orphaned inode. To repair the filesystem, it will turn these orphaned inodes into files. Although, the file had a name and location once, that information is no longer available - fsck deposits the file in a specific directory, called lost+found.

    I haven't seen an orphaned inode for years - they used to be pretty common when I worked on SCO/Unix but I think with journaled filesystems like ext2/3 they've just don't happen any more.

  2. David Johnston
    July 7, 2016 at 5:19 am

    /bin holds command line utilities written before 1985. Anything later was relegated to /usr/bin
    /sbin holds commands written before 1980, that would otherwise be in /bin
    /boot is where boot code used to go before it was all thrown into modules
    /dev is where devices poorly pretend to be files.
    /etc is where you need to fix the configuration but don't have permission to do so.
    /home is the directory that should have been called /usr
    /lib is the place where vulnerabilities hidden in libraries can be shared between applications
    /media doesn't exist on a serious system
    /mnt is where many things that are not a disk pretend to be a disk.
    /opt is where the useful version exists.
    /proc is where the ioctls went to die.
    /root is where a normal user spends their time in a shell
    /run away
    /srv isn't used by anything, even servers
    /sys would be useful if it wasn't all 600
    /tmp is where you find filespace. Files left here are immortal.
    /usr is where users don't get to go
    /var nish. You get to polish your webpages here.

    • Denis
      July 7, 2016 at 6:44 am

      This is the best comment I've read in a very long time. Thumbs up, David :)

    • Bertel King, Jr.
      July 7, 2016 at 5:26 pm

      I agree with Denis. Thanks for this, David!

    • Anders Jackson
      July 7, 2016 at 8:44 pm

      Nope. /bin and /sbin was needed during boot. /usr/bin and /usr/svin (or /usr/{bin,sbin}) are where all other commands for users and systems was stored. This because disc space was low, so you only had one disk to boot from. /usr/ was mounted in later stages during a boot.

      /home/ is should and was on some systems called /users/. /usr/ was never intended for ordinary users. Just system use.

      You use /share/ hierarchy with /share/{bin,lib}/ etc that could be shared between different architectures over network. The /lib/ and /usr/lib/ was used for program libraried, like libm.a and libc.a etc. Later they also stored shared libraries versions, that is loaded when programs starts and not staticly linked. That is libm.so etc. You could also find data files there for programs.

      /srv/ is where you put different virtual websites in Apache on serious installations. Also where you store data for servers. In serious server installations. Amatures doesn't configure and thus not use /srv/ in their installation.

      /var/ is where log files go and standard package installations of the default Web page for Apache and other servers. And where Amatures let them stay instwd of configure Apache and use /srv/

  3. fcd76218
    July 6, 2016 at 9:35 pm

    What I would like to know is what is the purpose of "/lost & found" folder?

    • jawtheshark
      July 7, 2016 at 8:27 am

      If a fsck recovers files, it can't put back where they belong, it will put it in lost+found. Similar to those FILEnnnn.CHK files on DOS/Windows
      Usually anything it finds, will be useless anyway.

      • fcd76218
        July 7, 2016 at 12:14 pm

        Muchas gracias!

Leave a Reply

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