Categories
Tech

A Cheatsheet Of Linux File System And Structure

Although I’m not completely new to the Linux operating system, the file system on Linux is still confusing to me. I watched a video about the Linux file/structure system. It’s time to put down some notes and get familiar with them. Let’s go!

  • /bin – binaries:
    • For programs and applications.
  • /sbin – system binaries:
    • For root/admin users only.
  • /boot – contains everything a system needs to boot
    • e.g. boot loader
  • /dev – devices:
    • Everything is a file in Linux. Hardware like a disk, webcam, the keyboard will be stored here, including their drivers.
  • /etc – etcetera:
    • It stores all the system-wide configuration files.
  • /lib – libraries (includes lib, lib32 and lib64)
    • Libraries of applications
  • /mnt and /mnt – mount:
    • For other mounted drives. You’ll typically see /mnt instead of the/mdeia directory. However, most distros nowadays automatically mount devices for you in the media directory.
    • When you mount a drive manually, use the /mnt directory
    • e.g. external hard drive, USB flash drive, network drive
  • /opt – optional:
    • Manually installed software lives here. Some software packages found in the repo can also be found here.
    • You can also put your own software in this directory.
  • /proc – processes:
    • Pseudo files that contain information about system processes and resources.
    • e.g. A directory that contains information on a running process; information of the CPU, etc.
  • /root – home folder of a root user
    • A directory where only a root user has access.
  • /run:
    • A relatively new directory. It is a tempfs file system. It runs in RAM. Anything in this directory will be deleted after rebooting the system. It is used for processes that start early in the boot procedures to store runtime information.
  • /snap:
    • It stores snap packages(mainly used for Ubuntu). Snap packages are self-contained applications that run differently from other applications.
  • /srv – server:
    • It stores server data. Files that will be accessed by external users. e.g. you set up an FTP server. Files can go here, which is separated from the other files for security purposes.
  • /sys – system:
    • A way to interact with the kernel. This is also a temporary directory created every time the system boot up. Similar to the /run directory.
  • /tmp – temporary:
    • Files that temporarily stored for applications. It’s usually empty after you reboot a system.
    • e.g. temporary files of a word processor application.
  • /usr – user application:
    • Applications installed by a user or for a user only. Applications installed in this directory considered non-essential for basic system operation.
    • Under the /usr directory, there are folders such as lib, bin, and sbin.
    • /usr/local contains software installed from the source code.
    • /usr/shared contains larger software.
    • /usr/src contains installed source code such as kernel header files.
    • Different software or distros may treat these folders differently.
  • /var – variable:
    • Files and directories that are expected to grow in size.
    • e.g. /var/crash contains information about files that are crashed; /var/log contains log files of many applications.
  • /home:
    • Each user has its own /home folder.
    • Storage of your personal files and documents.
    • Each user can only access their own /home folder unless they use admin permissions.
    • It has some hidden directories that start with a dot. e.g. .cache, .config. These hidden folders are used by different applications for their settings. You can see them by using the ls -a command in the terminal.
    • You can back up the hidden directories and restore them in a new system. After reinstalling your applications, the settings will be restored.

Credit/Source of information: DorianDotSlash

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.