Linux Directory Structure Explained: Purpose of Major Directories

Linux arranges files and directories according to certain standards. When you first encounter Linux, you might be confused about what directories like /etc, /var, /usr, and /proc each mean.

To summarize the key points first, configuration files are mainly stored in /etc, logs and variable data in /var, programs and libraries in /usr, and user files in /home.

In this article, we explain the purpose of major Linux directories and, if the directory name is an abbreviation, what it means.

Overview of Major Linux Directories

Directory Meaning of the Name Main use
/ Root The top-level directory of the Linux filesystem
/bin Binary Basic command executable files
/boot Boot Boot-related files such as the kernel and bootloader
/dev Device Device files such as disks and terminals
/etc Traditionally derived from et cetera System and service configuration files
/home Home General user's home directories
/lib Library Shared libraries
/lib64 64-bit Library Shared libraries for 64-bit systems
/media Media Mounting removable devices such as USBs and CDs/DVDs
/mnt Mount Temporary mount location for the filesystem
/opt Optional Additional installation programs
/proc Process Virtual filesystem providing process and kernel information
/root Root Home directory of the root user
/run Run Runtime data generated after boot
/sbin System Binary System administration commands
/srv Service Service data provided by the server
/sys System Virtual filesystem providing device and kernel information
/tmp Temporary Temporary file storage
/usr Unix System Resources Programs, commands, libraries, shared data
/var Variable Data that constantly changes, such as logs and cache

/ - Root directory

/ is the top-level directory in the Linux file system.

Unlike the concept of drives in Windows, in Linux all directories and files are connected under /.

/
├── bin
├── boot
├── dev
├── etc
├── home
├── usr
└── var

/ is called the root directory, and it is a different concept from /root, the home directory of the root user account.

/bin - Basic commands

bin is an abbreviation for Binary.

It stores the executable files of the basic commands needed to use the system. Typical commands include ls, cp, mv, cat, etc.

ls /bin

In many recent Linux distributions, /bin is not an actual directory but a symbolic link pointing to /usr/bin.

ls -ld /bin

/boot - Boot-related files

/boot stores the kernel and bootloader-related files necessary to boot the Linux system.

Representative files and directories are as follows.

/boot/vmlinuz-...
/boot/initramfs-...
/boot/grub2/

It is a directory mainly checked when updating the kernel or changing GRUB bootloader settings.

/dev - Device files

dev is an abbreviation for Device.

In Linux, devices such as hard disks, SSDs, and terminals are represented in the form of files.

/dev/sda
/dev/sdb
/dev/nvme0n1
/dev/tty
/dev/null

For example, /dev/sda can represent a disk device, and /dev/null is a special device file that discards any input data.

/etc - System configuration files

/etc is one of the most frequently used directories when managing a Linux server.

It mainly stores configuration files for the operating system and various services.

/etc/passwd
/etc/fstab
/etc/hosts
/etc/ssh/sshd_config

When changing various settings such as SSH, Apache, Nginx, network, and user accounts, files under /etc are modified.

/home - General user home directory

/home is a directory that stores personal files and settings of regular users.

For example, if you create a user named john, the following home directory is generally created.

/home/john

When a user logs in, the default working location also becomes their own home directory.

/lib, /lib64 - Shared Libraries

lib is an abbreviation for Library.

Shared libraries required to run Linux’s basic programs and commands are stored here.

On 64-bit systems, the /lib64 directory can be found.

In recent Linux distributions, /lib and /lib64 are often symbolic links pointing to /usr/lib and /usr/lib64, respectively.

/media - Mounting Removable Devices

/media is the location used when mounting removable storage devices such as USB memory, CDs, and DVDs.

On desktop Linux, when you connect a USB device, it is often automatically mounted under /media or /run/media.

/mnt - Temporary Mount

/mnt is a name derived from Mount.

It is mainly used when an administrator temporarily mounts a disk or network file system.

mount /dev/sdb1 /mnt

If /media is often used for the automatic mounting of removable devices like USBs, /mnt is frequently used for temporary mounts made manually by the administrator.

/opt - Additional Installed Programs

opt stands for Optional.

Apart from the default package structure of a Linux distribution, commercial programs or third-party applications that are installed separately are mainly located here.

/opt/application/
/opt/company/product/

/proc - Process and kernel information

proc stands for Process.

/proc is not a regular directory that stores data on the actual disk, but a virtual filesystem provided by the Linux kernel that offers system information in the form of files.

CPU information can be checked with the following command.

cat /proc/cpuinfo

Memory information can be checked as follows.

cat /proc/meminfo

If the process ID is 1234, you can find various information about that process in the /proc/1234 directory.

/root - Home directory of the root user

/root is the home directory of the root user, the system administrator account.

Regular user → /home/user
Root user → /root

The root directory / and the root user's home directory /root have different meanings.

/run - Runtime data

/run stores temporary runtime information used by services and processes after the system boots.

Typical examples include PID files, sockets, and service status information.

/run/
/run/user/
/run/systemd/

Generally, the data in /run is stored in memory and is initialized when the system reboots.

/sbin - System management commands

sbin generally stands for System Binary.

It contains commands required for system administration.

/sbin/reboot
/sbin/fsck

In recent Linux distributions, /sbin is often set up as a symbolic link pointing to /usr/sbin.

/srv - Service Data

srv stands for Service.

It is a directory for storing service data provided by the system to the outside, such as for web servers or FTP servers.

/srv/www/
/srv/ftp/

However, the actual location of service data may vary depending on the distribution or administrator settings, and for web servers, /var/www is often used.

/sys - System and Device Information

sys stands for System.

/sys, like /proc, is a virtual file system provided by the kernel rather than an actual disk directory.

It is mainly used to check information about devices, drivers, kernel objects, etc.

ls /sys/class

It is used to check information about the CPU, network interfaces, storage devices, or to control certain kernel attributes.

/tmp - Temporary files

tmp is an abbreviation for Temporary.

It is a space for storing files temporarily needed by programs or users.

/tmp

Depending on system policies, files may be deleted after a reboot or after a certain period of time, so it should not be used for storing important data.

/usr - Programs and System Resources

/usr is a directory that takes up a very large portion in Linux.

In modern Linux environments, it is generally described to mean Unix System Resources, and stores program executable files, libraries, documents, shared data, and more.

Directory Purpose
/usr/bin General commands and programs
/usr/sbin System administration programs
/usr/lib Shared libraries
/usr/lib64 64-bit shared libraries
/usr/share Architecture-independent shared data such as documents and icons
/usr/local Programs installed directly by the administrator

In particular, /usr/local is useful for distinguishing between programs installed by package managers and those installed directly by administrators.

/var - constantly changing data

var stands for Variable.

It stores data that is continuously generated or changes in size while the system is running.

/var/log
/var/cache
/var/lib
/var/spool

/var/log

Log files of the system and services are stored.

ls /var/log

/var/cache

It stores cache data used by programs to improve performance.

/var/lib

It stores state data that services and applications continuously use.

/var/spool

It is used to store data waiting to be processed, such as mail, print jobs, and scheduled tasks.

On the server, especially the log files in /var/log can continue to grow and take up a lot of disk space, so it is a good idea to periodically check their usage.

How to easily memorize Linux directories

You don’t need to memorize the purpose of all directories from the beginning. It is convenient to remember them starting with the directories that are frequently used in server management as follows.

/etc → Configuration files
/var → Logs and constantly changing data
/home → Regular user data
/root → Root user home
/usr → Programs and libraries
/tmp → Temporary files
/dev → Devices
/proc → Process and kernel information
/sys → System and device information
/boot → Boot files
/mnt → Temporary mounts
/opt → Additional installed programs

In particular, at first, if you remember the four directories /etc for configuration, /var for logs, /usr for programs, and /home for user files, it will help in actual Linux management.

Summary of Linux directory structure

Linux directories each have a relatively clear role. System settings are mainly stored in /etc, logs and variable data in /var, programs and libraries in /usr, and user files in /home.

It is also useful to know that /proc and /sys are not regular disk directories but virtual file systems that provide kernel information.

When managing a Linux server, you will continuously encounter these directories, so rather than just memorizing the paths, it is more effective to understand what kind of data each directory stores.

More in This Category
Linux sed Command: Search and Replace Text Streams

Linux sed Command: Search and Replace Text Streams

Learn how to search and Replace Text Streams with the Linux sed command, including practical examples, key options, and important precautions.

Linux join Command: Combine Files by a Common Field

Linux join Command: Combine Files by a Common Field

Learn how to combine Files by a Common Field with the Linux join command, including practical examples, key options, and important precautions.

Linux du Command: Check File and Directory Disk Usage

Linux du Command: Check File and Directory Disk Usage

Learn how to use the Linux du command to measure and summarize disk space used by files and directories, with essential options, practical examples, output interpretation, and common troubleshooting tips.

Best Linux Distributions for Web Servers: Ubuntu, Debian, or Rocky Linux?

Best Linux Distributions for Web Servers: Ubuntu, Debian, or Rocky Linux?

Compare Ubuntu Server, Debian, and Rocky Linux for web hosting based on support lifecycle, package freshness, documentation, operational stability, and application requirements.

Linux rsync Command: Synchronize Files and Directories

Linux rsync Command: Synchronize Files and Directories

Learn how to synchronize Files and Directories with the Linux rsync command, including practical examples, key options, and important precautions.

Linux whereis Command: Locate Binaries, Source, and Man Pages

Linux whereis Command: Locate Binaries, Source, and Man Pages

Learn how Linux whereis locates binaries, source files, and manual pages, limits each search type, lists effective paths, and differs from which and find.

Linux fdisk Command: Inspect and Edit Disk Partitions

Linux fdisk Command: Inspect and Edit Disk Partitions

Learn how to inspect and Edit Disk Partitions with the Linux fdisk command, including practical examples, key options, and important precautions.

Linux uptime Command: Check Uptime and Load Averages

Linux uptime Command: Check Uptime and Load Averages

Learn how to use the Linux uptime command to check how long the system has been running and interpret load averages, with essential options, practical examples, output interpretation, and common troubleshooting tips.

Linux grep Command: Search Text and Filter Command Output

Linux grep Command: Search Text and Filter Command Output

Learn how to use the Linux grep command to search files for text or regular expressions and filter command output, with essential options, practical examples, output interpretation, and common troubleshooting tips.

Linux scp Command: Copy Files over SSH

Linux scp Command: Copy Files over SSH

Learn how to copy Files over SSH with the Linux scp command, including practical examples, key options, and important precautions.