The root filesystem should generally be small, since it contains very critical files and a small, infrequently modified filesystem has a better chance of not getting corrupted. A corrupted root filesystem will generally mean that the system becomes unbootable except with special measures (e.g., from a floppy), so you don’t want to risk it.
The root directory generally doesn’t contain any files, except perhaps on older systems where the standard boot image for the system, usually called /vmlinuz was kept there. (Most distributions have moved those files the the /boot directory. Otherwise, all files are kept in subdirectories under the root filesystem:
The following list provides information about the contents of some of the subdirectories of the / (root) file system.
Item | Description |
---|---|
/etc | Contains configuration files that vary for each machine. Examples include:/etc/hosts/etc/passwdThe /etc directory contains the files generally used in system administration. Most of the commands that previously resided in the /etc directory now reside in the /usr/sbin directory. However, for compatibility, the /usr/sbin directory contains symbolic links to the locations of some executable files. Examples include:/etc/chown is a symbolic link to /usr/bin/chown./etc/exportvg is a symbolic link to /usr/sbin/exportvg. |
/bin | Symbolic link to the /usr/bin directory. In prior UNIX file systems, the /bin directory contained user commands that now reside in the /usr/bin directory. |
/sbin | Contains files needed to boot the machine and mount the /usr file system. Most of the commands used during booting come from the boot image’s RAM disk file system; therefore, very few commands reside in the /sbin directory. |
/dev | Contains device nodes for special files for local devices. The /dev directory contains special files for tape drives, printers, disk partitions, and terminals. |
/tmp | Serves as a mount point for a file system that contains system-generated temporary files. The /tmp file system is an empty directory. |
/var | Serves as a mount point for files that vary on each machine. The /var file system is configured as a file system since the files it contains tend to grow. See /var file system for more information. |
/u | Symbolic link to the /home directory. |
/usr | Contains files that do not change and can be shared by machines such as executables and ASCII documentation.Standalone machines mount the root of a separate local file system over the /usr directory. Diskless machines and machines with limited disk resources mount a directory from a remote server over the /usr file system. See /usr file system for more information about the file tree mounted over the /usr directory. |
/home | Serves as a mount point for a file system containing user home directories. The /home file system contains per-user files and directories.In a standalone machine, the /home directory is contained in a separate file system whose root is mounted over the /home directory root file system. In a network, a server might contain user files that are accessible from several machines. In this case, the server copy of the /home directory is remotely mounted onto a local /home file system. |
/export | Contains the directories and files on a server that are for remote clients.See /export directory for more information about the file tree that resides under the /export directory. |
/lib | Symbolic link to the /usr/lib directory. See /usr file system for more information. |
/tftpboot | Contains boot images and boot information for diskless clients. |
/bin
Commands needed during bootup that might be used by normal users (probably after bootup).
/sbin
Like /bin, but the commands are not intended for normal users, although they may use them if necessary and allowed. /sbin is not usually in the default path of normal users, but will be in root’s default path.
/etc
Configuration files specific to the machine.
/root
The home directory for user root. This is usually not accessible to other users on the system
/lib
Shared libraries needed by the programs on the root filesystem.
/lib/modules
Loadable kernel modules, especially those that are needed to boot the system when recovering from disasters (e.g., network and filesystem drivers).
/dev
Device files. These are special files that help the user interface with the various devices on the system.
/tmp
Temporary files. As the name suggests, programs running often store temporary files in here.
/boot
Files used by the bootstrap loader, e.g., LILO or GRUB. Kernel images are often kept here instead of in the root directory. If there are many kernel images, the directory can easily grow rather big, and it might be better to keep it in a separate filesystem. Another reason would be to make sure the kernel images are within the first 1024 cylinders of an IDE disk. This 1024 cylinder limit is no longer true in most cases. With modern BIOSes and later versions of LILO (the LInux LOader) the 1024 cylinder limit can be passed with logical block addressing (LBA). See the lilo manual page for more details.
/mnt
Mount point for temporary mounts by the system administrator. Programs aren’t supposed to mount on /mnt automatically. /mnt might be divided into subdirectories (e.g., /mnt/dosa might be the floppy drive using an MS-DOS filesystem, and /mnt/exta might be the same with an ext2 filesystem).
/proc, /usr, /var, /home
Mount points for the other filesystems. Although /proc does not reside on any disk in reality it is still mentioned here. See the section about /proc later in the chapter.
The following table provides a very brief list of the standard, well-known, and defined top-level Linux directories and their purposes.
Directory | Description |
---|---|
/ (root filesystem) | The root filesystem is the top-level directory of the filesystem. It must contain all of the files required to boot the Linux system before other filesystems are mounted. It must include all of the required executables and libraries required to boot the remaining filesystems. After the system is booted, all other filesystems are mounted on standard, well-defined mount points as subdirectories of the root filesystem. |
/bin | The /bin directory contains user executable files. |
/boot | Contains the static bootloader and kernel executable and configuration files required to boot a Linux computer. |
/dev | This directory contains the device files for every hardware device attached to the system. These are not device drivers, rather they are files that represent each device on the computer and facilitate access to those devices. |
/etc | Contains the local system configuration files for the host computer. |
/home | Home directory storage for user files. Each user has a subdirectory in /home. |
/lib | Contains shared library files that are required to boot the system. |
/media | A place to mount external removable media devices such as USB thumb drives that may be connected to the host. |
/mnt | A temporary mountpoint for regular filesystems (as in not removable media) that can be used while the administrator is repairing or working on a filesystem. |
/opt | Optional files such as vendor supplied application programs should be located here. |
/root | This is not the root (/) filesystem. It is the home directory for the root user. |
/sbin | System binary files. These are executables used for system administration. |
/tmp | Temporary directory. Used by the operating system and many programs to store temporary files. Users may also store files here temporarily. Note that files stored here may be deleted at any time without prior notice. |
/usr | These are shareable, read-only files, including executable binaries and libraries, man files, and other types of documentation. |
/var | Variable data files are stored here. This can include things like log files, MySQL, and other database files, web server data files, email inboxes, and much more. |
- Best AI tools for Software Engineers - November 4, 2024
- Installing Jupyter: Get up and running on your computer - November 2, 2024
- An Introduction of SymOps by SymOps.com - October 30, 2024