The Filesystem

3.3. The File System

3.3.1. The Filesystem Hierarchy Standard

As with other Linux distributions, Kali Linux is organized to be consistent with the Filesystem Hierarchy Standard (FHS), allowing users of other Linux distributions to easily find their way around Kali. The FHS defines the purpose of each directory. The top-level directories are described as follows.

  • /bin/: basic programs

  • /boot/: Kali Linux kernel and other files required for its early boot process

  • /dev/: device files

  • /etc/: configuration files

  • /home/: user's personal files

  • /lib/: basic libraries

  • /media/*: mount points for removable devices (CD-ROM, USB keys, and so on)

  • /mnt/: temporary mount point

  • /opt/: extra applications provided by third parties

  • /root/: administrator's (root's) personal files

  • /run/: volatile runtime data that does not persist across reboots (not yet included in the FHS)

  • /sbin/: system programs

  • /srv/: data used by servers hosted on this system

  • /tmp/: temporary files (this directory is often emptied at boot)

  • /usr/: applications (this directory is further subdivided into bin, sbin, lib according to the same logic as in the root directory) Furthermore, /usr/share/ contains architecture-independent data. 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).

  • /var/: variable data handled by daemons. This includes log files, queues, spools, and caches.

  • /proc/ and /sys/ are specific to the Linux kernel (and not part of the FHS). They are used by the kernel for exporting data to user space.

3.3.2. The User's Home Directory

The contents of a user's home directory are not standardized but there are still a few noteworthy conventions. One is that a user's home directory is often referred to by a tilde ("~"). That is useful to know because command interpreters automatically replace a tilde with the correct directory (which is stored in the HOME environment variable, and whose usual value is /home/user/).

Traditionally, application configuration files are often stored directly under your home directory, but the filenames usually start with a dot (for instance, the mutt email client stores its configuration in ~/.muttrc). Note that filenames that start with a dot are hidden by default; the ls command only lists them when the -a option is used and graphical file managers need to be explicitly configured to display hidden files.

Some programs also use multiple configuration files organized in one directory (for instance, ~/.ssh/). Some applications (such as the Firefox web browser) also use their directory to store a cache of downloaded data. This means that those directories can end up consuming a lot of disk space.

These configuration files stored directly in your home directory, often collectively referred to as dotfiles, have long proliferated to the point that these directories can be quite cluttered with them. Fortunately, an effort led collectively under the FreeDesktop.org umbrella has resulted in the XDG Base Directory Specification, a convention that aims at cleaning up these files and directories. This specification states that configuration files should be stored under ~/.config, cache files under ~/.cache, and application data files under ~/.local (or subdirectories thereof). This convention is slowly gaining traction.

Graphical desktops usually have shortcuts to display the contents of the ~/Desktop/ directory (or whatever the appropriate translation is for systems not configured in English).

Finally, the email system sometimes stores incoming emails into a ~/Mail/ directory.