organizacion-sistema-de-archivos-en-linux

Organization of the File System in Linux

  • 3 min

One of the aspects that often proves most challenging for those learning Linux is facing 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. Furthermore, the names of system directories are abbreviations, so, at first, they are less descriptive and intuitive than in Windows.

In this post, we will describe the purpose and functionality of the different folders that make up the Linux file system. The following diagram shows a summary of the file structure (click to enlarge):

estructura-archivos-linux

  • / (root): Primary hierarchy. Root directory (all other directories hang from this one).

  • /boot (boot): Essential files loaded at boot (Grub, Kernel, initrd…).

  • /bin (binaries): Essential binary applications and commands, needed for single-user 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 in 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. Local user data.

  • /usr/share: Architecture-independent shared files (configuration files, images, icons…).

  • /usr/bin: Non-administrative executables shared by users. Contains most desktop applications (e.g., firefox).

  • /usr/sbin: Non-essential system binaries (e.g., daemons for network services).

  • /usr/include: Header files for C and C++.

  • /usr/lib: Libraries for C and C++ shared by all users.

  • /usr/src: Source code for certain applications.

  • /var (variable): Variable files and temporary files in general.

    • /var/cache: Application cache.

    • /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, which lock shared resources while 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 reboots).

    • /var/spool: Tasks waiting to be processed (print queues, unread mail…).

    • /var/log: System log files.

    • /var/mail: Mailbox or user messages.

  • /root (superuser): Root user’s home directory.

  • /tmp (temporary): Temporary files (deleted on 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 drives, CD/DVD, and additional partitions).

  • /opt (optional): Optional program packages for applications shared among users.

  • /lost+found (lost and found): Information related to repairs performed by fsck due to an improper system shutdown.

  • /proc (processes): Virtual file system that documents the kernel and process status in text files.

  • /srv (services): System information about certain services (FTP, HTTP…).

  • /sys (system): Information about devices as seen by the Linux kernel.