Language: EN


Organization of the File System in Linux

One of the aspects that is usually more difficult for those who are learning Linux is dealing with the file organization system. The file structure in Linux is more organized and strict than in other systems, which can be intimidating for new users. Additionally, the system directory names are abbreviations so, at first, they are less descriptive and intuitive than Windows.

In this post we are going to describe the object and functionality of the different folders that make up the Linux file system. The following scheme shows the summary of the file structure (click to enlarge). estructura-archivos-linux / (root): Primary hierarchy. Root directory (all other directories hang from this) /boot (boot): Fundamental files loaded at boot (Grub, Kernel, initrd…). /bin (binaries): Binary applications and essential commands, necessary for single or multi-user sessions. /sbin (system binaries): System binary applications and commands, exclusive to the root user. /etc: Configuration files for installed programs, as well as certain scripts that run at system startup.     /etc/opt: Configuration files for programs installed within the /opt directory.     /etc/X11: Configuration files for the X Window System, version 11.     /etc/sgml: Configuration files for SGML.     /etc/xml: Configuration files for XML. /usr (user): Secondary hierarchy. Utilities and applications shared by all users (read-only).     /usr/local: Tertiary hierarchy. User local data.     /usr/share: Architecture-independent shared files (configuration files, images, icons…)     /usr/bin: Non-essential shared executables for users. Contains most desktop applications (e.g. firefox).     /usr/sbin: Non-essential system binaries (e.g. network service daemons).     /usr/include: Header files for C and C++.     /usr/lib: Shared libraries for C and C++ used by all users.     /usr/src: Source code for certain applications. /var (variable): Variable files and temporary files in general.     /var/cache: Application cache memory.     /var/crash: Data and information related to system crashes and errors.     /var/lib: Information about the current state of applications, modifiable by the applications themselves.     /var/lock: Lock files, lock shared resources while they are in use.     /var/opt: Variable data used by packages stored in /opt.     /var/run: Information about the system since the last boot.     /var/tmp: Temporary files (not deleted between sessions or system restarts)     /var/spool: Tasks waiting to be processed (print queues and unread mail…).     /var/log: System log files.     /var/mail: User mailboxes or messages. /root (superuser): Root user’s home directory. /tmp (temp): Temporary files (deleted at system startup). /dev (devices): Contains files representing all system devices. /home (home): Working directories for all users, except root (personal settings, saved files…) /lib (libraries): System libraries, as well as modules and drivers. /mnt (mounts): Temporarily mounted file systems. /media (media): Mount points for removable storage media (USB, floppy disks, CD/DVD, and additional partitions). /opt (optional): Optional program packages for applications shared among users. /lost+found: Information related to repairs made by fsck due to an improper system shutdown. /proc (processes): Virtual file system that documents the kernel and the state of processes in text files. /srv (services): System information about certain services (FTP, HTTP…). /sys (system): Information about devices as seen by the Linux kernel.