Linux Root File Structure


flowchart LR subgraph "Windows History" A((boot)) --> B["DOS (Disk operating system)"] B --> C[Windows]; C --> D{{"C:\WINDOWS"}}; A --> E[Windows]; subgraph "Now" E --> F{{"C:\Program Files"}}; end end subgraph "Linux History" G[BSD] --> H[Unix]; H --> I[Mac OS]; H --> J[Linux]; J --> K[Ubuntu]; J --> Q[Debian]; J --> Z[Raspi] end

Filesystem Hierarchy Standard (FHS)

  1. Linux cares capitalization in file or folder name unlike windows.
  2. bin : binaries for programs and applications, such as ls, cat, bash, etc. (single user mode only, not multi-users)
  3. sbin: system binaries that a system admin would use, not for normal user. (single user mode only)
  4. Single user mode is a special mode that boots you in as a root user to allow you to do system repairs updates, etc. Networking is disable because of security issues. When you install a program in Linux, it is not placed in bin or sbin.
  5. boot: anything to boot the os. Don't touch it.
  6. cdrom: an old mounting point for your cdrom.
  7. dev: device, like your hardwares, nvme disk /dev/nvme* , hardware disk /dev/sda*, nvidia gpu /dev/nvidia* , etc. Also, webcam and keyboard. Don't touch this driver folder.
  8. etc: edit to configure, et cetera (the rest), this stores all system-wide configuration files, such as, network, apt, ssh, apache2, nginx, etc. This is for system wide applications.
  9. home: folder to store all users desktops.
  10. lib, lib32, lib64: libraries. Applications can use to perform various functions, they are required by binaries in bin and sbin.
  11. media, mnt: mount. These are for other mounted drives, like floppy disk, usb stick, external hard drive, network drive, or a second hard drive. It is like D:/ and E:/ and so on.
  12. opt: optional folder for manually installed software. I put opencv here.Can install software created yourself.
  13. proc: pseudo files that contain information about system processes and resources, for example, every process will have a directory here.
  14. 
    cat /proc/cpuinfo
    cat /proc/uptime
        
  15. root: root users home folder.
  16. run: new folder, it is a tempfs file system. It runs in RAM, everything is gone when system is rebooted or shutdown. It is used to store info started early in boot procedure to store runtime info that they use to function.
  17. snap: to store snap packages.
  18. srv: service directory where service data is stored. If a server like web server or ftp server is running, you would store files that will be accessed by external users here for better security reason.
  19. sys: system folder. It is a way to interact with the kernel.
  20. tmp: temporary directory where files are temporarily stored by applications. Should be empty after reboot.
  21. usr: user application space. Applications are installed by the user, they are considered non-essential for basic system operation. Most programs installed from source code will end up in the local folders of usr. Larger programs are in share.
  22. var: variable directory. It contains files and directories that are expected to grow in size, like some of the log files.
  23. Hide files are in . format.

References