Linux Directories

Cybersecurity Linux Lesson 1.1.1


/boot (boot)

  • The /boot (read as root, boot) directory contains all the files required for the system’s boot process
    • Includes the kernel of the system, RAM images, bootloader configuration files, etc.

      /proc (processes)

  • The /proc directory contains information about processes, hardware configuration, and kernel parameters
    • E.g. /proc/in.fo provides information about the system’s CPU

      /sys (system info)

  • The /sys directory holds information about the kernel parameters and device attributed
    • E.g. /sys/gpio can manipulate the GPIO pins on embedded systems

      /var (variables)

  • The /var directory contains all the files that change while the system is being used
    • Mainly used for storing variables data that is generated by services and applications
    • Logs are stored in /var/log
    • Cached data is stored in /var/cache

      /usr (user’s info)

  • The /usr directory contains data and resources about system users
    • /usr/bin contains commands, executables, utilities, and applications
    • /usr/share contains fonts, images, documentations, etc

      /lib (libraries)

  • The /lib directory contains libraries for the system typically needed for the early stages of the boot process
    • Occassionally split in /lib32 and /lib 64 for 32-bit and 64-bit libraries, respectively

      /dev (hardware devices)

  • The /dev directory contains device files that provide access to hardware devices on the system
    • /dev/sda typically represents the first hard drive (or /dev/sda1 as first partition)
    • /dev/ttyS0 is usually a serial port
    • /dev/null and /dev/zero are used for input/output

      /etc (config files)

  • The /etc directory contains configuration files and shell scripts for the system
    • /etc/fstab is the file system table

      /opt (optional software)

  • The /opt directory holds optional/add-on software packages
    • Allows for easy management and helps prevent conflicts with system files

      /bin (binaries or commands)

  • The /bin directory contains the essential executable files for the system to function
    • Contains the fundamental commands for the system to function including ls, cp, mv, etc.

      /sbin (system binaries or commands)

  • The /sbin directory is reserved for system administrators and contained essential system binaries
    • Commands included within this directory are fdisk, reboot, and ifconfig
    • These commands must be run as superuser

      /home (user directory folder)

  • The /home directory is where system users home directories are located
    • /home/student would be the home directory for a user, student

      /root (root directory folder)

  • The /root directory is the home directory for the superuser/root account
    • Contains config files, scripts, etc.

      /media (removable storage devices)

  • The /media directory is used as a mount point for removable media devices such as USB drives, external hard drives, optical discs, etc.

    /mnt (mount point)

  • The /mnt directory is a general-purpose mount point used for temporarily mounting filesystems or devices
    • /mnt can be used for any kind of mount operation

      /tmp (temporary files)

  • The /tmp directory is a location for storing temporary files and directories
    • May be deleted by the system during reboots or to free up disk space