# Main Index: Debian Linux Magic Spells Cheat Sheet (one liners, how to, tips and tricks)
# Linux Filesystem Hierarchy
Meaning of Linux directories:
/ # Root directory. The operating system kernel must be located in either / or /boot.
/bin # Essential user command binaries (for use by all users). It contains commands that may be used by both the system administrator and by users, but which are required when no other filesystems are mounted (e.g. in single user mode). It may also contain commands which are used indirectly by scripts.
/boot # Static files of the boot loader. Files required for booting the system. This directory contains everything required for the boot process except configuration files not needed at boot time and the map installer. Thus /boot stores data that is used before the kernel begins executing user-mode programs. This may include saved master boot sectors and sector map files.
/cdrom # Non standard directory for CD Roms. It should be inside /media instead.
/dev # Device files.
/etc # Et cetera. Host-specific system configuration. The /etc hierarchy contains configuration files. A "configuration file" is a local file used to control the operation of a program; it must be static and cannot be an executable binary. It is recommended that files be stored in subdirectories of /etc rather than directly in /etc.
/etc/opt # Configuration files for /opt .
/etc/X11 # Configuration for the X Window System (optional).
/etc/sgml # Configuration files for SGML (optional).
/etc/xml # Configuration files for XML (optional).
/home # User home directories. No program should assume any specific location for a home directory, rather it should query for it. (optional).
/lib # Essential shared libraries and kernel modules needed to boot the system and run the commands in the root filesystem, ie. by binaries in /bin and /sbin.
/lost+found # Files recovered after a system crash.
/media # Mount point for removable media. This directory contains subdirectories which are used as mount points for removable media such as floppy disks, cdroms, zip disks.
/mnt # Mount point for a temporarily mounted filesystem. This directory is provided so that the system administrator may temporarily mount a filesystem as needed. The content of this directory is a local issue and should not affect the manner in which any program is run. This directory must not be used by installation programs: a suitable temporary directory not in use by the system must be used instead.
/opt # Add-on application software packages. A package to be installed in /opt must locate its static files in a separate /opt/[package] or /opt/[provider] directory tree, where [package] is a name that describes the software package and [provider] is the provider's LANANA (Linux Assigned Names And Numbers Authority) registered name.
/proc # Kernel and process information virtual filesystem.
/root # Home directory for the root user (optional). The root account's home directory may be determined by developer or local preference, but this is the recommended default location.
/run # Run-time variable data. This directory contains system information data describing the system since it was booted. Files under this directory must be cleared (removed or truncated as appropriate) at the beginning of the boot process. The purposes of this directory were once served by /var/run. In general, programs may continue to use /var/run to fulfill the requirements set out for /run for the purposes of backwards compatibility. Programs which have migrated to use /run should cease their usage of /var/run, except as noted in the section on /var/run. Programs may have a subdirectory of /run; this is encouraged for programs that use more than one run-time file. Users may also have a subdirectory of /run, although care must be taken to appropriately limit access rights to prevent unauthorized use of /run itself and other subdirectories.
/sbin # Essential system binaries. Utilities used for system administration (and other root-only commands) are stored in /sbin, /usr/sbin, and /usr/local/sbin. /sbin contains binaries essential for booting, restoring, recovering, and/or repairing the system in addition to the binaries in /bin. Programs executed after /usr is known to be mounted (when there are no problems) are generally placed into /usr/sbin. Locally-installed system administration programs should be placed into /usr/local/sbin.
/srv # Data for services provided by this system.
/sys # Kernel and system information virtual filesystem.
/tmp # Temporary files. Programs must not assume that any files or directories in /tmp are preserved between invocations of the program. It is recommended that files and directories located in /tmp be deleted whenever the system is booted. Temporary files that can survive a reboot should be stored in /var/tmp .
/usr # "usr" stands for "UNIX System Resources", not "user". It contains shareable, read-only data.
/usr/bin # Most user commands. This is the primary directory of executable commands on the system.
/usr/include # Directory for standard include files. This is where all of the system's general-use include files for the C programming language should be placed.
/usr/lib # Libraries for programming and packages.
/usr/libexec # Binaries run by other programs (optional). It includes internal binaries that are not intended to be executed directly by users or shell scripts. Applications may use a single subdirectory under /usr/libexec. Applications which use /usr/libexec in this way must not also use /usr/lib to store internal binaries, though they may use /usr/lib for the other purposes documented here. /usr/lib can be also used if /usr/libexec is missing.
/usr/local # Local hierarchy, for use by the system administrator when installing software locally. It needs to be safe from being overwritten when the system software is updated. It may be used for programs and data that are shareable amongst a group of hosts, but not found in /usr. Locally installed software must be placed within /usr/local rather than /usr unless it is being installed to replace or upgrade software in /usr.
/usr/sbin # Non-essential standard system binaries. This directory contains any non-essential binaries used exclusively by the system administrator. System administration programs that are required for system repair, system recovery, mounting /usr, or other essential functions must be placed in /sbin instead. There must be no subdirectories in /usr/sbin.
/usr/share # Architecture-independent data. This hierarchy is intended to be shareable among all architecture platforms of a given OS; thus, for example, a site with i386, Alpha, and PPC platforms might maintain a single /usr/share directory that is centrally-mounted. Note, however, that /usr/share is generally not intended to be shared by different OSes or by different releases of the same OS. Any program or package which contains or requires data that doesn't need to be modified should store that data in /usr/share (or /usr/local/share, if installed locally). It is recommended that a subdirectory be used in /usr/share for this purpose. Applications using a single file may use /usr/share/misc. Game data stored in /usr/share/games must be purely static data. Any modifiable files, such as score files, game play logs, and so forth, should be placed in /var/games.
/usr/share/color # Color management information (optional).
/usr/share/dict # Word lists (optional).
/usr/share/man # Manual pages.
/usr/share/misc # Miscellaneous architecture-independent data.
/usr/share/ppd # Printer definitions (optional).
/usr/share/sgml # SGML data (optional).
/usr/share/xml # XML data (optional).
/usr/src # Source code (optional). The only source code that should be placed in a specific location is the Linux kernel source code. It is located in /usr/src/linux.
/var # variable data files. This includes spool directories and files, administrative and logging data, and transient and temporary files. Some portions of /var are not shareable between different systems. For instance, /var/log, /var/lock, and /var/run. Other portions may be shared, notably /var/mail, /var/cache/man, /var/cache/fonts, and /var/spool/news. /var exists in order to make it possible to mount /usr read-only. Everything that once went into /usr that is written to during system operation (as opposed to installation and software maintenance) must be in /var.
/var/account # Process accounting logs (optional). This directory holds the current active process accounting log and the composite process usage data (as used in some UNIX-like systems by lastcomm and sa).
/var/cache # Application cache data. /var/cache is intended for cached data from applications. Such data is locally generated as a result of time-consuming I/O or calculation. The application must be able to regenerate or restore the data. Unlike /var/spool, the cached files can be deleted without data loss. The data must remain valid between invocations of the application and rebooting the system. Files located under /var/cache may be expired in an application specific manner, by the system administrator, or both. The application must always be able to recover from manual deletion of these files (generally because of a disk space shortage). No other requirements are made on the data format of the cache directories.
/var/cache/fonts # Locally-generated fonts (optional). It should be used to store any dynamically-created fonts. In particular, all of the fonts which are automatically generated by mktexpk must be located in appropriately-named subdirectories of /var/cache/fonts. An application (or a group of inter-related applications) must use a subdirectory of /var/lib for its data. There is one required subdirectory, /var/lib/misc, which is intended for state files that don't need a subdirectory; the other subdirectories should only be present if the application in question is included in the distribution.
/var/cache/man # Locally-formatted manual pages (optional).
/var/crash # System crash dumps (optional).
/var/games # Variable game data (optional).
/var/lib # Variable state information. State information is data that programs modify while they run, and that pertains to one specific host. Users must never need to modify files in /var/lib to configure a package's operation, and the specific file hierarchy used to store the data must not be exposed to regular users.
/var/lib/[editor] # Editor backup files and state (optional).
/var/lib/color # Color management information (optional).
/var/lib/hwclock # State directory for hwclock (optional).
/var/lib/misc # Miscellaneous variable data.
/var/lock # Lock files. Lock files for devices and other resources shared by multiple applications, such as the serial device lock files that were originally found in either /usr/spool/locks or /usr/spool/uucp, must now be stored in /var/lock. The naming convention which must be used is "LCK.." followed by the base name of the device. For example, to lock /dev/ttyS0 the file "LCK..ttyS0" would be created. The format used for the contents of such lock files must be the HDB UUCP lock file format. The HDB format is to store the process identifier (PID) as a ten byte ASCII decimal number, with a trailing newline. For example, if process 1230 holds a lock file, it would contain the eleven characters: space, space, space, space, space, space, one, two, three, zero, and newline.
/var/log # Log files and directories. This directory contains miscellaneous log files. Most logs must be written to this directory or an appropriate subdirectory. The following files, or symbolic links to files, must be in /var/log, if the corresponding subsystem is installed: lastlo: record of last login of each user; messages: system messages from syslogd; wtmp: record of all logins and logouts.
/var/mail # User mailbox files (optional). User mailbox files in this location must be stored in the standard UNIX mailbox format.
/var/opt # Variable data for /opt . This is where the static data from an add-on software package is stored, except where superseded by another file in /etc .
/var/run # Run-time variable data. This directory was once intended for system information data describing the system since it was booted. These functions have been moved to /run; this directory exists to ensure compatibility with systems and software using an older version of this specification.
/var/spool # Application spool data. It contains data which is awaiting some kind of later processing. Data in /var/spool represents work to be done in the future (by a program, user, or administrator); often data is deleted after it has been processed.
/var/spool/cron # cron and at jobs. This directory contains the variable data for the cron and at programs.
/var/spool/lpd # Line-printer daemon print queues (optional). The lock file for lpd, lpd.lock, must be placed in /var/spool/lpd. It is suggested that the lock file for each printer be placed in the spool directory for that specific printer and named lock.
/var/spool/rwho # Rwhod files (optional).
/var/tmp # Temporary files preserved between system reboots.
/var/yp # Network Information Service (NIS) database files (optional). Variable data for the Network Information Service (NIS), formerly known as the Sun Yellow Pages (YP), must be placed in this directory.
Please DONATE to support the development of Free and Open Source Software (PayPal, Credit Card, Bitcoin, Ether)
Page issued on 25-Sep-2022 04:41 GMT