Directory Hierarchies

The Linux file system is organized as a tree. Table 4.4 shows the file system tree for a typical Linux system starting from the root directory /.


\begin{myfigure}{Linux File System}
\begin{verbatim}/
├── bin
├── ...
...€ src
└── var
├── log
└── spool\end{verbatim}
\end{myfigure}

Working with the Linux file system is accomplished by using either absolute paths that begin with the root (/) and specify the full path to the file or directory, or by using relative paths that are specified in relation to the current position (directory) within the file system.

The root (top-level) directory of the system is denoted as `/'. Some of the common sub-directories in the root directory are: home, bin, sbin, usr, etc, var, dev, lib, proc, boot and tmp.

The home directory is where the login or home directories for users are kept. For example,/home/alice is the name of the home directory for the user alice.

The directory /bin (short for binary) contains executable programs commonly used by all users. Look at the programs in that directory. If you are curious about any particular program, then read the man page for that program with the man command. The directory sbin contains programs used for system administration.

The directory /lib contains shared libraries and drivers. The directory /var contains variable data used by several system programs. The directory boot has some basic programs that help in booting up the system. The directory /mnt contains mount points for mounting a file system temporarily. For example, this is where your USB drives will show up. The proc directory is where we can access information about the operating system and the underlying hardware. For example, try cat /proc/version.

The directory /etc contains system setup information. For example, it contains the filepasswd that contains the login information about all the users in the system. Under theusr directory, there are are many important system directories. For example, the system man pages are kept in the directory /usr/share/man.

The directory /tmp (short for temporary) is a directory in which any user can write. You can use this directory as a place for storing files temporarily. Usually the /tmp directory has much more space than your home directory. The files in this folder are purged periodically by the system administrator. On your personal machine, they will remain there until you remove them.



Subsections