File Structure

    user@linux:~$ cd ~/../LinuxMaster/Documents/file-structure

File Management and Design

Compared to Windows, UNIX based operating systems including Linux and macOS manage files using drastically different structures. While Windows mounts drives individually using letter names, Linux places the entire file system under directories at the root (/). Applications and program files have best practices for locations, but are not held to a strict policy, causing some variance between Linux distributions, package managers, and application types.

Basic Syntax

Linux uses methodologies that are not seen across other operating systems and requires some high level understanding for file system proficiency.

  • Files
    • Anything that contains data as a document or executable binary.
    • Examples: file.txt, app.py, presentation.pptx, index.html
  • Directories
    • Known as folders in Windows
    • contain files and other directories
  • Links
    • Logical or symbolic references to files and directories in other locations
    • Examples: A Documents/ folder located in /home that points to a separate disk

Default Directories

*based off of Ubuntu’s file structure

LocationNameUsage
/rootParent directory of file system
/binbinariesContains executable utilities
/bootbootContains files needed to start operating system
/devdevicesContains physical and logical devices; i.e. keyboard
/etcet ceteraContains configuration files and tables; i.e. fstab
/homehomeContains individual user directories
/liblibrariesContains kernel modules and drivers
/lib64libraries 64Libraries folder for 64-bit systems.
/mediamediaContains removable devices such as USB, DVD
/mntmountContains filesystem mount points; i.e. extra disks
/optoptionalContains software not included in installation
/procprocessesContains runtime system information; i.e. memory
/sbinsystem binariesContains utilities to start, maintain, recover system
/rootroot homeContains /home style directory for root user
/srvserver dataContains data for services provided by system
/tmptempContains temporary files, cleared at boot
/usruserContains non-critical shared executables and resources
/varvariableContains data such as printer queues and web files
/swapswapContains spare virtual memory for paging, hibernation

References

Dell - The types and definitions of Ubuntu Linux Partitions and Directories Explained

The Linux Juggernaut - /etc explained

Linuxtopia - Linux Filesystem Hierarchy