Exploring Your Linux System

Exploring a Linux System

In Linux the file system is a single entity that begins with / (root). There are no drive letters, mappings or other method of switching from disk to disk, or partition to partition. All resources, including files, hardware, and even other computers are stored as subdirectories of the root. The Linux file system adheres to a standard called the Filesystem Hierarchy Standard. FHS was developed as a method to standardize configuration file and directory storage on different Linux platforms so that application developers and administrators had consistency across all computers. Started in 1993, FHS was adopted as a standard in 1996, and is now implemented on most Linux and Unix systems.

FHS mandates the existence of a number of directories, and dictates the files that must reside in these directories. A comprehensive explanation of FHS can be found at http://www.pathname.com/fhs/2.0/fhs-toc.html. Below is a table of some of the most common FHS directories.

/bin: Binary commands to be used by all users.

/boot: Generally a separate partition, but not always. Contains the boot loader and kernel.

/dev: Files that correspond to hardware devices. Note that these files are placeholders, and the actual hardware my not exist. For example, you will have a file /dev/sda, even if you don’t have a SCSI device on your system.

/etc: Operating system configuration files are stored here. If XWindows is installed, a directory /etc/X11 will also be created for XWindows configuration files.

/home: Optional – for home directories.

/lib: Libraries and kernel modules. Libraries are conceptually similar to .DLL files under Windows, or .NLM files under Netware.

/mnt: Temporary file systems such as your CD-ROM and Floppy are mounted here. This directory will contain a subdirectory for each file system, which is configured to read from and write to the corresponding hardware file in /dev. For example, you can always access your CD-ROM by changing to /mnt/cdrom, regardless of the actual device (/dev/hdb, /dev/hdc) that represents your CD-ROM.

/opt: Created to hold installed software packages. Similar to \Program Files on Windows.

/root: Optional – The root users home directory

/sbin: System binaries generally reserved for administration and system maintenance. Many administrators change the permissions on this directory such that only root has access.

/usr: A major subsection of FHS containing subdirectories that represent the applications and utilities that make up the Linux system. Files in this directory are generally read only. Many applications will install executable files in this folder. Similar to the \Windows or \Winnt folders.

/tmp: Temporary files

/var: Used to contain variable data such as log files. Many applications also store working data here. The Apache web server stores the root web site in a subdirectory of /var, usually /var/www/html.

Below are some additional rules regarding the file system.

  • All files, and thus all commands are case sensitive.
  • Linux does not denote file type using extensions as Windows does. All files are either binary or ASCII information and in order to properly view the contents of the file, you must open in using the appropriate application.
  • Permissions on a file control whether or not that file is executable. Those files with the execute bit set, can be executed. Any file can be made executable, although not all files will execute.

Due to the complexity of the Linux file system, commands to aid in locating files exist. Some of these commands include the whereis and find utilities.