Table of Contents
Understanding Important Directories
The Linux filesystem is organized as a single tree that starts at the root directory /. Beneath this root, a set of standard directories each serves a specific purpose. Understanding what lives where is essential for finding files, configuring your system, and avoiding mistakes that could break your installation.
This chapter focuses on the most important system directories, the ideas behind their design, and how you should interact with them as a beginner.
Important rule: Never delete or move files in system directories like /bin, /sbin, /lib, /usr, /etc, /var, or /boot unless you are absolutely sure what you are doing. Removing the wrong file can make your system unbootable.
System vs user space
Linux separates the filesystem into areas that belong to the system and areas that belong to users.
System space contains the operating system itself and software managed by the package manager. These locations include directories such as /bin, /sbin, /lib, /usr, /etc, /var, and /boot. Files here are usually owned by root, and changing them directly can interfere with package management or system stability.
User space contains data and settings for regular users. The main place for this is /home, where each user normally has a private directory, for example /home/alex. Inside your home directory you are free to create, modify, and delete files, and you do not need administrative permissions for that.
Learning which directories belong to the system and which belong to you will help you understand permission errors and why some actions require sudo.
Top level directories you will see
If you run ls / in a terminal, you will see a consistent set of directories across almost all Linux distributions. Some of the most common are /bin, /sbin, /lib, /usr, /etc, /var, /home, /tmp, /dev, /proc, /sys, /run, /media, and /mnt.
Even though distributions differ, the basic meaning of these directories is shared. This structure is guided by the Filesystem Hierarchy Standard, a document that describes where files should be placed. Not every distribution follows it perfectly, but the core ideas are similar, so once you learn them, you can move between systems more easily.
`/bin` and `/sbin`: Essential commands
The directory /bin contains essential user commands that must be available even if no other filesystem is mounted. Examples include basic tools such as ls, cp, mv, rm, cat, and sh. These are required for normal operation and for emergency maintenance.
The directory /sbin serves a similar role but for system administration binaries. These are programs used mainly by the system or by the root user. Examples include tools for managing disks or starting system services. Ordinary users may not have permission to run many programs in /sbin directly, or may not need them in daily work.
On some modern systems, /bin and /sbin might actually be symbolic links to locations inside /usr. From a beginner perspective, you can still treat /bin and /sbin as the place for core executable programs.
Important statement: Commands in /bin and /sbin are part of the base operating system. Do not replace or manually edit these programs. Use the package manager to install, update, or remove them.
`/lib` and `/lib64`: Shared libraries
Programs often rely on shared libraries, which provide common code that many applications can use. These are usually stored in /lib and, on 64 bit systems, /lib64. For example, the standard C library, which almost every compiled program uses, lives here.
You generally do not interact with /lib directly. The dynamic linker automatically finds libraries here when you run programs. Package managers place libraries in these directories and keep track of versions.
Removing or changing libraries in /lib can have immediate and severe effects because many programs will no longer start if their required library is missing.
`/usr`: Userland programs and data
The directory /usr is one of the largest parts of the system. It is often described as containing secondary programs and data, not required for the system to boot into a minimal environment but essential for normal multi user operation.
Inside /usr, you will see subdirectories that mirror the root structure. Common ones include /usr/bin for most user commands, /usr/sbin for additional system administration tools, /usr/lib for libraries, and /usr/share for architecture independent data such as icons, documentation, and localization files.
On many modern systems, almost all executable programs you use daily are located under /usr/bin. When you install applications from the distribution repositories, they usually end up somewhere in /usr.
For a beginner, it is enough to know that /usr is part of the system area, managed by the package manager, and not a place where you normally create personal files.
`/boot`: Startup files
The /boot directory holds files needed to start the operating system. This includes the Linux kernel image, the initial RAM filesystem (initramfs), and often the configuration files and modules for the bootloader such as GRUB.
These files are used before the operating system is fully running. Because of this, /boot might be on a dedicated partition that the firmware or bootloader can read.
You rarely need to touch /boot directly. Kernel updates and bootloader configuration changes are usually handled by tools and packages that modify this directory correctly.
Important rule: Do not manually delete old kernel images from /boot unless you fully understand the consequences. Use your distribution’s tools to clean up unused kernels if needed.
`/root`: The root user’s home directory
The directory /root is the home directory for the root user, which is the superuser account with full control over the system. This is not the same as the root of the filesystem / even though the names are similar.
Just like other users have /home/username, the root user has /root. Configuration files and personal data for root go here. Regular users normally have no reason to enter or modify this directory.
Understanding the difference between / and /root helps avoid confusion when reading documentation or error messages.
`/run`: Volatile runtime data
The /run directory contains information about the current running system. This can include process identifiers, lock files, and sockets used for communication between processes. The contents of /run exist only while the system is powered on. When you reboot, /run is usually cleared.
Service managers and system daemons rely heavily on /run. For example, a service might place a file in /run to record its process ID so that other tools can interact with it.
As an end user, you rarely need to work with /run directly, but you may see paths under /run mentioned in debugging or when reading log messages.
`/media` and `/mnt`: Mount points
In Linux, all filesystems are attached to the single tree that starts at /. The directories /media and /mnt are used as places where other storage devices or remote filesystems are attached.
The directory /media is typically used for automatically mounted removable media such as USB drives or DVDs. When you plug in a USB stick on a desktop system, it may appear under a path like /media/yourname/USBSTICK.
The directory /mnt is usually reserved for temporary or manual mounts that an administrator creates. For example, if you want to attach another partition for inspection, you might run a command that mounts it at /mnt/inspect.
You can explore these directories to find external storage devices, but you should avoid manually creating long term structures here unless you are setting up specific mount points and understand how they work.
`/opt`: Optional third party software
The directory /opt is often used for optional, third party software that is not managed by the distribution’s normal package system. Some commercial applications or large self contained packages install their files into subdirectories under /opt, such as /opt/vlc or /opt/google.
Unlike /usr, where files are carefully integrated with the system’s package manager, /opt tends to hold standalone software distributions that bring most of their files together in one place.
If you manually install software from a vendor provided installer, it may choose /opt as its location. As a user, you normally do not need to create files here unless you are following installation instructions that specifically mention it.
`/srv`: Service data
The directory /srv is intended to hold data for system services that the machine provides. For example, if the system hosts a web server or an FTP server, the content served to clients may live under /srv/www or /srv/ftp.
Many distributions still place service data in other locations by default, so /srv might be empty on your system. However, its purpose is to be the standard location for service specific data when administrators choose to use it.
For a desktop or laptop system that is not acting as a server, you may not interact with /srv at all.
`/lost+found`: Recovered file fragments
On filesystems such as ext4, each partition may contain a directory named /lost+found at its root. For the main system partition, this appears as /lost+found.
During filesystem checks, if the system finds damaged or orphaned file fragments, it can place recovered pieces in this directory. The contents are usually not human friendly and may appear as numbered files or directories without meaningful names.
You can ignore /lost+found in normal use. Its presence simply indicates that the filesystem can store recovered data if needed.
`/tmp`: Temporary files
The /tmp directory is a shared location for temporary files created by different programs and users. Many applications use /tmp when they need short lived storage, for example when you open a file from a browser or extract an archive.
On many systems, files in /tmp are deleted automatically on reboot or after a certain time. This behavior can vary, but you should treat /tmp as a place where data is not meant to persist.
You can use /tmp yourself for quick experiments. For example, you might create a file in /tmp when testing a command. However, do not rely on anything in /tmp to be available long term.
Important rule: Do not store important documents in /tmp. Temporary directories may be cleaned automatically, which will remove your files without warning.
How these directories relate to you as a user
As a regular user, you will spend most of your time inside your home directory under /home. The system directories exist to support your environment, but they are not the place for your personal data.
You will often read from system directories when you use commands, run applications, or follow tutorials, but writing to them usually requires sudo and should be done with care. Configuration files you edit by hand are often located under /etc, and they influence how the system behaves, but your own files are better stored in Documents, Downloads, or other directories under your home.
Understanding the purpose of each important directory helps you know where to look for things. When you see a path mentioned in documentation, you can quickly tell if it is a user area, a system configuration area, an executable program area, or a place for runtime data. Over time, this mental map of the filesystem will become natural, and navigating Linux systems will feel predictable and efficient.