Linux filesystem structure

·

2 min read

Linux File System is organized in directories, each directory serves a purpose, here you can find a short but precise description for the most useful directories.

If you need to get your current file path in Linux, you can check this post.

/

The root directory, all directories start from this directory.

/bin

Has programs essential for the system.

/boot

Has the Linux kernel, files needed for the boot sequence and boot configuration files.

/dev

Everything in Linux is a file, a device recognized by the system is represented by a file.

/etc

Has system wide configuration files, some of the most important are: crontab: scheduled tasks
fstab: mount points
* passwd: users

/home

Has directories for each user, a good practice is to keep this directory on a seperate partition.

/lib

Shared libraries for the programs.

/lost+found

It keeps filesystem recovered files, normally is empty.

/media

Mount points for removable media like usb.

/mnt

For things you mount manually or with fstab.

/opt

Usually is used to install optionall software.

/proc

Its a virtual file system which keeps files for running processes.

/root

The home directory for the root user.

/sbin

Programs that used from the root user.

/tmp

Used to keep temporary files used by the processes, its emptied after a reboot.

/usr

Contains programs/files used by regular users.

/usr/bin

Contains programs installed by the Linux installer.

/usr/lib

Shared libraries for programs in /usr/bin.

/usr/local

Programs that are not installed by the Linux installer, but are used for system wide usage.

/usr/sbin

Programs executed with sudo or root user, usually system administration things.

/usr/share

Files shared by programs in /usr/bin.

/usr/share/doc

Documentation files of programs in /usr/bin.

/var

Holds files that usually changes over time, like databases files.

/var/log

Logs of various programs.