Linux File Management
Overview
Time: 10 min
Learn the file oragnisation in a Linux OS.
Understand the difference between Unix and Linux.
Explanation
Difference between Unix and Linux:
Unix vs Linux Comparison Feature
Unix
Linux
Proprietary or Free?
Proprietary (mostly)
Free and open source
Developed When?
1970s
1991
Developed By
AT&T Bell Labs
Linus Torvalds + community
Variants
AIX, HP-UX, Solaris, etc.
Ubuntu, Fedora, Debian, etc.
Certification
Unix-certified by The Open Group
Not Unix-certified
Linux File System
/
├── bin
├── boot
├── dev
├── etc
├── home
│ ├── alice
│ └── bob
├── lib
├── media
├── mnt
├── opt
├── proc
├── root
├── run
├── sbin
├── tmp
├── usr
│ ├── bin
│ ├── lib
│ └── share
└── var
└── log
The Linux filesystem is organized as a hierarchical directory tree. Below is a breakdown of the top-level directories and their purposes according to the Filesystem Hierarchy Standard (FHS).
Root Directory
/The root of the filesystem. All other directories stem from here.
System and Boot Directories
/binEssential user binaries needed for basic system functionality, such as
ls,cp, andmv./sbinEssential system binaries, typically used for system administration, such as
fsckandreboot./bootContains files needed to boot the system, including the Linux kernel and bootloader configurations.
/liband/lib64Shared libraries required by binaries in
/binand/sbin./lib64holds 64-bit libraries.
User and Software Directories
/usrSecondary hierarchy for read-only user data and installed software. Contains:
/usr/bin: Non-essential user binaries./usr/lib: Libraries for binaries in/usr/bin./usr/share: Architecture-independent shared data.
/optOptional software packages from third-party vendors.
/homeHome directories for all users (e.g.,
/home/alice,/home/bob)./rootHome directory of the root (superuser).
Configuration and Temporary Directories
/etcHost-specific configuration files.
/tmpTemporary files used by applications, typically cleared on reboot.
/varVariable data files, such as logs, mail, and spool directories.
Devices and Mount Points
/devContains device files (e.g.,
/dev/sda,/dev/null), which represent hardware devices./procVirtual filesystem providing process and kernel information as files (e.g.,
/proc/cpuinfo)./sysVirtual filesystem for exposing information about hardware devices and associated kernel modules.
/runStores volatile runtime data like PID files and socket information.
/mntUsed for temporarily mounting filesystems, often by system administrators.
/mediaMount point for removable media such as USB drives and CD-ROMs.
Extra HPC directories:
Directory |
Explanation |
|---|---|
|
Pre-installed or centrally maintained software applications available to all users (e.g. compilers, MPI, MATLAB, etc.). Often used with modules like |
|
Likely a group-shared storage area. Often used in universities or research orgs for shared group project files. |
|
High-performance temporary workspace for large files or experiments. Usually purged periodically. |
Key Points
Linux follows a hierarchical directory structure, starting from the root directory /.
Key directories include /bin, /sbin, /usr, /etc, /home, and /var.
Key HPC directories include apps/, g/, and scratch/.