4.3 Where Data is Stored (Weight: 3)
📘Linux Essentials (LPI 010-160)
1. Root Directory (/)
- The top-level directory in Linux.
- All other directories and files are under
/. - Examples of important directories under
/will be discussed below.
2. /bin – Essential User Binaries
- Contains essential command-line programs needed for basic tasks.
- Programs in
/bincan be used even in single-user mode (recovery mode). - Examples:
ls– list filescp– copy filesmv– move filescat– view file content
Exam Tip: Remember /bin contains essential commands for all users.
3. /sbin – System Binaries
- Contains system programs used mainly by the system administrator (root).
- Used for system maintenance and administration.
- Examples:
ifconfig– manage network interfacesreboot– reboot the systemfdisk– manage disk partitions
Exam Tip: /sbin = admin commands.
4. /etc – Configuration Files
- Contains system-wide configuration files.
- Almost all programs store their configurations here.
- Examples:
/etc/passwd– stores user account information/etc/fstab– filesystems to mount at boot/etc/ssh/sshd_config– SSH server settings
IT Example: If an IT admin wants to change network settings, they might edit /etc/network/interfaces.
5. /home – User Home Directories
- Each user has a personal directory under
/home. - Stores user files and personal settings.
- Example:
/home/pooja/– files for the userpooja
IT Example: Developers store their project files under their /home directories.
6. /root – Root User Home
- This is the home directory for the root user (the superuser).
- Different from
/home. - Example:
/root/.bashrcstores root’s shell settings.
7. /lib – Essential Libraries
- Stores shared libraries needed by programs in
/binand/sbin. - Libraries are like “helper files” for programs to run.
- Examples:
libc.so.6– core system librarylibm.so– math functions
Exam Tip: /lib is for essential libraries for basic system operation.
8. /usr – User Programs and Data
- Contains user applications and utilities that are not essential for booting.
- Subdirectories:
/usr/bin– non-essential user programs (e.g.,vim,firefox)/usr/sbin– admin programs for non-critical system tasks/usr/lib– libraries for/usr/binand/usr/sbin/usr/share– shared data like icons, documentation, fonts
IT Example: Software installed from the package manager usually goes here.
9. /var – Variable Data
- Contains files that change frequently.
- Examples:
/var/log– system logs/var/mail– user emails/var/spool– print jobs or scheduled tasks
IT Example: Checking /var/log/syslog helps troubleshoot system errors.
10. /tmp – Temporary Files
- Used for temporary files created by users or programs.
- Files in
/tmpare deleted on reboot on many systems.
11. /dev – Device Files
- Represents hardware devices like disks, USB drives, printers.
- Files in
/devare special interfaces to devices. - Examples:
/dev/sda– first hard drive/dev/tty– terminal devices
IT Example: Mounting a USB drive uses /dev/sdb1 as the device file.
12. /mnt and /media – Mount Points
/mnt– temporary mount points for manual mounting./media– used for removable media like USB drives or CDs.- Example:
/media/usbdrive/for a USB stick.
13. /boot – Boot Loader Files
- Contains files required to boot Linux.
- Examples:
- Kernel files:
vmlinuz - Bootloader configs:
grub/
- Kernel files:
Exam Tip: /boot is critical for booting; don’t delete files here.
14. /opt – Optional Software
- Used for third-party or optional software.
- Often used by commercial software.
- Example:
/opt/google/chrome/
15. /proc – Process and Kernel Information
- A virtual filesystem that provides info about running processes and kernel.
- Example:
/proc/cpuinfo– CPU details/proc/meminfo– memory details
IT Example: Admins check /proc to monitor system hardware and performance.
16. /sys – System Files
- Another virtual filesystem for kernel and hardware information.
- Mostly used by the system, scripts, and administrators.
Quick Reference Table for Exams
| Directory | Purpose | Example Use |
|---|---|---|
/ | Root directory | Top of filesystem |
/bin | Essential commands | ls, cp |
/sbin | Admin commands | fdisk, reboot |
/etc | Configuration files | passwd, ssh/sshd_config |
/home | User directories | /home/pooja/ |
/root | Root user home | /root/.bashrc |
/lib | Essential libraries | libc.so.6 |
/usr | User programs | /usr/bin/vim |
/var | Variable data | Logs, mail |
/tmp | Temporary files | Temp files by programs |
/dev | Device files | /dev/sda, /dev/tty |
/mnt | Mount points | Manual mounts |
/media | Removable media | USB drives |
/boot | Boot files | Kernel, GRUB |
/opt | Optional software | Third-party apps |
/proc | Process info | /proc/cpuinfo |
/sys | System info | Kernel data |
Key Points for the Exam
- All Linux files and directories start at
/. /binand/sbinare for essential commands;/usris for additional programs.- Configuration files are mostly in
/etc. - User data is in
/home. - Logs and dynamic data are in
/var. - Device files live in
/dev. - Temporary files in
/tmp. - Virtual filesystems
/procand/sysprovide system info without using real disk space. /optis optional,/bootis critical for booting.
This content covers everything you need for the Linux filesystem hierarchy section of LPI 010-160.
