hello friends! new(ish)!

GNU/Linux Directory Structure

From InstallGentoo Wiki v2
Revision as of 10:49, 11 December 2022 by >Fvleshvvare (→‎/usr/share)
Jump to navigation Jump to search

GNU/Linux and other UNIX-like operating systems follow a similar directory structure, as defined by the Filesystem Hierarchy Standard, an organization maintained by the Linux foundation. There are also some directories that aren't defined by the standard.

/

/ or Root directory is the top-most directory in the hierarchy. This is where all the other file systems or mounted when the system boots up. Not to be confused with /root.

/bin

/bin stands for binaries. It contains necessary coreutils required to mount other directories. In most distributions, this exists as a symlink to /usr/bin.

/boot

The /boot directory contains all the files necessary for booting up the system. Mostly consists of bootloader and kernel files.

/dev

/dev abbreviates as devices. Everything is a file in GNU/Linux, even devices. The hardware is represented as a special file. Also contains some pseudo-devices, such as /dev/urandom and /dev/null.

/etc

The /etc (et cetera) directory consists of system-wide configuration files and databases.

/lib

The /lib directory has some important C libraries required by the /bin directory. There also exists lib32 and/or lib64 depending on the system architecture. It exists as a symlink to /usr/lib in most distributions.

/home

The home directory has a folder for each user. It enables to have user-specific configuration files. By default each user has read and write access to their home directory and must need special elevated permissions to modify files outside their home directory. If your username is gentoo, then your home directory would be /home/gentoo.

/media

The mount point for devices such as USB drives and other media devices.

/opt

/opt (Optional) is where locally installed software exists.

/mnt

Temporary directories are mounted in /mnt. For example, in a dual-booted system, you'd mount the windows partition as /mnt/windows.

/tmp

This is the place where temporary files are stored. This directory is cleaned during startup.

/root

This is similar to a /home directory but for the root user, aka system administrator.

/sbin

This is like a /bin directory but for commands used by system administrators. Consists of important commands for starting, maintaining and recovering the system.

/usr

The /usr directory contains executable, libraries, and other shared resources.

/usr/share

/usr/local

/var

The /var (variable) directory, is where important information like caches, log files, etc are stored. This is similar to /tmp but the files aren't clear during startup.

Example directory structure

bin -> usr/bin
boot
dev
etc
home
lib -> usr/lib
lib64 -> usr/lib
lost+found
mnt
opt
proc
root
run
sbin -> usr/bin
srv
sys
tmp
usr
var
Note: The -> refers to symlinks