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.
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, 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.
/sbin holds binaries reserved for system administrators. These are the commands that normal users may not need to access.
These are the files that your computer needs to boot. This is where your bootloader and the Linux kernel 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.
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.
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.
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).
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.
/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.
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.
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.
The name is short for optional. This is a space third-party software can use, such as Java or Google Chrome.
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.
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 rather than view them directly.
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.
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.
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.
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.
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, but that doesn’t mean every bit of data needs to stick around forever.
User-facing applications and tools appear in this directory. Here you can find binaries, source code, icons, documentation, and other useful data.
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.
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!