LINFO

Root Directory Definition



The root directory is the directory on Unix-like operating systems that contains all other directories and files on the system and which is designated by a forward slash ( / ).

The use of the word root in this context derives from the fact that this directory is at the very top of the directory tree diagram (which resembles an inverted tree) that is commonly used to represent a filesystem. A filesystem is the hierarchy of directories that is used to organize directories and files on a computer.

In some operating systems, such as MS-DOS and the various Microsoft Windows systems, there is no single root directory. Rather, there is a separate root directory for each storage device and partition (i.e., logically independent section) of the hard disk drive (HDD), and they are labeled A: for the floppy drive, C: for the first partition of the HDD, D: for the second partition of the HDD, etc. Advocates of Unix-like operating systems claim that having a single root directory offers some important advantages, particularly with regard to system security.

The first tier (i.e., top level) of directories within the root directory are fairly standardized on Unix-like operating systems, although there are some differences according to the specific operating system or the distribution (i.e., version) of Linux. Directories that are installed by default in the root directory typically include /bin, /boot, /dev, /etc, /home, /initrd, /lib, /lost+found, /misc, /mnt, /opt, /proc, /root, /sbin, /tmp, /usr and /var. Most of these directories, in turn, contain other directories and their subdirectories as well as files, although a few may be empty, at least initially (e.g., /lost+found, /misc and /opt).

The name of any of these top level directories in the root directory is typically preceded by a forward slash when discussing them. This absolute pathname designation is used in order to avoid confusion with directories with similar names located elsewhere in the system, e.g., /bin and /usr/local/bin. An absolute pathname, also called a full pathname, specifies the location of a directory or file in relation to the root directory and thus always begins with a forward slash.

The system administrator, or other users who have the appropriate permissions, can create additional directories within the root directory if desired, just as they can do within any of its subdirectories. Permissions are rights granted by the system administrator to other users to read, write or execute (i.e., run) files and commands.

The contents of the root directory can be viewed, assuming the user has the proper permissions, by issuing the ls (i.e., list) command with the root directory as an argument (i.e., input file) as follows:

ls /

A user can change its current directory (i.e., the directory in which the user is currently working) to the root directory from wherever it is on the system by using the cd (i.e., change directory) command with the root directory as an argument, again assuming that such user has the proper permissions, as follows:

cd /

Although the default on some Linux distributions is to allow ordinary users to view the contents of the root directory and to change into it, this is generally not a wise policy for large, multiuser systems. The reason is that it could make it easier for a malicious user or outsider to purposely damage the system or obtain confidential information. This danger exists to some extent even if the permissions for the key directories and subdirectories within the root directory retain their default settings that make them inaccessible to ordinary users, because access to the root directory can provide a skilled intruder with another entry point to obtain useful clues about the structure of the particular system and to probe for weaknesses.

The term root directory can also refer to the uppermost directory in a branch of the directory tree that is on a separate partition or on separate media (e.g., a separate HDD) from the root directory of the entire system. For example, if the /usr directory (inclusive of all its subdirectories) is housed on a separate partition or on a separate HDD, /usr becomes the root directory for all of its subdirectories, such as /usr/bin, /usr/etc, /usr/local and /usr/sbin.

The word root, when used by itself, refers to the root user or root account, i.e., the system administrator's account, which is the only user that has complete access to every command and file on the system.

The directory /root is a standard first tier directory in the root directory, and it is referred to as the root user's home directory (and not as the root directory). /root contains configuration files for the root user's account, and it is analogous to the home directories, which contain configuration and personal files for ordinary users.

The root filesystem is the (usually) truncated filesystem that is contained on the HDD partition on which the root directory is located. This is the only filesystem that is available when a system is brought up in single user mode. Single user mode is a way of booting (i.e., starting) a damaged system that has very limited capabilities so that repairs can be made to it.






Created December 24, 2004. Updated July 24, 2005.
Copyright © 2004 - 2005 The Linux Information Project. All Rights Reserved.