Imagine an operating system without a file system where all the data is placed in one large storage device with no way to tell where one piece of data stops and the next begins. This is where the file system comes into play which separates the data and giving each piece of data a name. This helps in data to be easily identified and isolated from others.
The file system contains Files and Directories. A file is a basic unit of storage for data. Represented by (-) in Command-line Interface (CLI). Linux uses directories to hold information about other files. Also, known as folders in Windows. Represented by (d) in the CLI.
Kali Linux is organized to be consistent with the Filesystem Hierarchy (FHS). The FHS defines the purpose of each directory, the top-level directories are described below.
- / : Every single file and directory starts from the root directory. Only the root user has the write privileges under this directory. /root is not the same as /. /root is the home directory of the administrator’s personal files.
- /bin: Basic Programs. This directory contains binary executables where common Linux commands are found in the directory. For example, ps, ls, ping, grep, cp, mv, etc.
- /sbin: System Programs. Contains binary executables, but is more related to system maintenance. For example, iptables, reboot, fdisk, ifconfig, etc.
- /etc: Contains configuration files required by all programs. Most applications will have a directory under this with all its configurations.
- /var: Contains files that are expected to grow or change constantly. This includes log files, queues, spools, and caches.
- /tmp: Contains temporary files. This directory is often emptied at boot.
- /home: Contains user’s personal files. This is where the home directories for all the users are located.
- /boot: Contains boot loader files. Kali Linux kernel and other files required for its early boot process.
- /dev: Contains device files.
- /lib: Contains basic libraries.
- /media/*: mount points for removable devices like CD-ROM, USB, and etc.
- /mnt: Temporary mount point.
- /opt: Contains extra applications provided by third parties or optional Add-on Apps.
- /srv: Contains data used by servers hosted on the system.
- /usr: This directory is further subdivided into bin, sbin, lib according to the same as in the root directory. The /usr/local/ directory is meant to be used by the administrator for installing applications manually without overwriting files handled by the packaging system (dpkg).
- /run: volatile runtime data that does not persist across reboots (not included in the FHS)
- /proc and /sys are used by the kernel for exporting data to userspace (not included in the FHS).