This guide will teach you about the Most Important Linux Directories and their contents. You’ll learn how to navigate the file system, find the files you need, and work with different types of directories.
Most Important Linux Directories
Files and directories are organized into a single-rooted inverted tree structure
Filesystem begins at the root directory, represented by / (forward slash)
Names are case-sensitive
Path are delimited by /
- Home Directories:
/root, /home/username
- User Executable:
/bin, /usr/bin, /usr/local/bin
- System Executables:
/sbin, /usr/sbin, /usr/local/sbin
- Other Mountpoints:
/media, /mnt
- Configuration:
/etc
- Temporary Files:
/tmp
- Kernels and Bootloader:
/boot
- Server Data:
/var, /srv
- System Information:
/proc, /sys
- Shared Libraries:
/lib, /usr/lib, /usr/local/lib
Every user has a home directory. All of the user’s personal files (configuration, data, or even applications) go here. Root’s home directory is /root. Most non-root home directories are in the /home tree, usually named after the user.
The essential binaries reside in /bin for user binaries and /sbin for system binaries. Non-essential binaries, such as graphical environments, or office tools installed in /usr/bin and /usr/sbin. The reason for this split is to minimize the size of the root partition. Software compiled from source code, usually go in /usr/local/bin and /usr/local/sbin.
When removable media is loaded the filesystem on the media is mounted into a subdirectory of /media. For example, a cdrom would usually be mounted under /media/cdrom and you would access that directory whenever you wanted to read a file from the cdrom. Filesystems that are on non-removable media but are not part of the Red Hat Enterprise linux hierarchy are usually mounted under /mnt.
Most of configuration files are stored in the /etc directory and its subdirectories.
/tmp is usually used by applications for storing temporary data. Once a day the system automatically deletes any files over ten days old in /tmp
The boot loader is in charge of loading the core of Red Hat Enterprise Linux, called the kernel, into memory. The boot loader, kernel and loader’s configuration files, are stored in /boot.
The /var directory contains regularly-changing system files such as logs, print spools and email spools. /srv contains server data such as databases and web pages.
/proc provides information about a running Linux system and allows some tweaking while a system is running. /sys is related to hardware.
The lib directories contain libraries that provide shared code used by many Linux applications. lib directories are similar to the three usr directories.