Linux Know-How provides a collection of introductory texts on often needed Linux skills.


File System Tree

Linux file system tree is large and complicated. It will vastly improve your skills if you familiarize yourself with it.

Briefly, typical Linux contains five file systems. These file systems can reside on a single or different physical hard drives and/or hard drive partitions, depending on the size and need of your system. (A single file system can also be distributed between different physical devices, if needed.)

/ The root file system contains basic operating system and maintenance tools. The content of this file system should be sufficient to start up the system and perform emergency maintenance and repairs if they were necessary.
/usr file system contains all commands, libraries, documentation, and other files that do not change during normal operation. This will also contain major applications that come with your Linux distribution, for example Netscape.
/var file system contains files that change: spool directories, log files, lock files, temporary files, and formatted (on use) manual pages.
/home file system contains user files (users' own settings, customization files, documents, data, mail, caches, etc). The contents of this directory should be preserved on an operating system upgrade.
/proc file system contains entirely illusionary files. They don't really exist on the disk and don't take up any space there (although ls -l will show their size). When viewing them, you really access information stored in the memory. It is used to access information about the system.

The parts of the root file system are:

/bin--executables (binaries) needed during bootup that might be used by normal users.

/sbin--executables (system binaries) not intended for use by general users (users may still use them, but this directory is not on their PATH).

/etc--system-wide configuration files for your operating system.

/root--the home directory of the system administrator (called super-user or root).

/dev--device files. Devices appear on Linux as files so that hardware is abstracted and it is easy to write to them or read from them.

/mnt--mount points for removable media (floppy, cdrom, zipdrive), partitions of other operating systems (e.g. MS Windows), network shares, and anything else that is mounted on the file system temporarily. It normally contains a separate subdirectory for each mounting share. The contents of these drives/shares appear in these subdirectories--there are no drive letters on Linux.

/lib--shared libraries for programs that reside on the root file system and kernel modules.

/boot--files used by the bootstrap loader (LILO or GRUB), the thing that loads first when the computer is booted and perhaps gives you the option of which operating system to boot, if you have more than one OS on your computer). It typically also contains the Linux kernel (compressed, file vmlinuz), but this can be stored somewhere else, if only LILO is configured to know where it is.

/opt--optional large applications, for example kde under RedHat 5.2 (under RedHat 6.0, kde is distributed as any other X-windows distribution, main executables are in the /usr/bin directory).

/tmp--temporary files. This directory may clean up automatically.

/lost+found--files recovered during the file system repair.

The most interesting parts of the /usr file system are:

/usr/X11R6--X-windows system (version 11, release 6).

/usr/X11--the same as /usr/X11R6 (it is a symbolic link to /usr/X11R6).

/usr/X11R6/bin --lots of small X-windows apps, and perhaps symbolic links to the executables of some larger X-windows applications that reside in their own subdirectories somewhere else).

/usr/doc--Linux documentation (on newer systems, this moved to /usr/share/doc).

/usr/share --Data independent from your computer architecture, e.g., dictionary words.

/usr/bin and /usr/sbin--similar to their equivalents on the root file system (/bin and /sbin), but not needed for basic bootup (e.g. during emergency maintenance). Most commands will reside here.

/usr/local--the applications installed by the local administrator (perhaps each application in a separate subdirectory). After the "main" installation, this directory is empty. The contents of this directory should survive normal re-installation or upgrade of the operating system.

/usr/local/bin--perhaps smaller "user"-installed executables, plus symbolic links to the larger executables contained in separate subdirectories under /usr/local.

It is important to understand that all directories appear in a single directory tree, even if the directories are contained on different partitions, physical drives (including floppies, etc), or even if they are distributed over the network. Therefore, there are no DOS-type "drive letters" under Linux. What would be a "drive" under DOS or MS Windows, appears on Linux as a subdirectory in a special "mounting" location.

The directory system is well-established and standard on most Linux distributions (the small differences are being currently addressed by the Linux Standard Base). It is also quite similar to that found on typical commercial UNIX systems.

To summarize:

  • Users always save their files to the directory /home/user_login_name (and its subdirctories)

  • The local administrator most likely installs the "additional" software under the directory /usr/local and makes a link to the main executable in /usr/local/bin.

  • System settings are all in the directory /etc.

  • It is not a good idea to temper with the content of the root directory ("/") or of the directory /usr, unless I really know what I want. These directories are best left as they came with my Linux distribution.

  • Most tools and applications installed on my system are in the directories: /bin, /sbin, /usr/bin, /sbin, /usr/X11/bin, /usr/local/bin.

  • All the files are in single directory tree. There are no drive letters.


Last Update: 2010-12-16