Saturday, 16 May 2015

Linux File System

On Linux and Unix, the directories start with the root directory (designated by a forward slash), which contains a series of subdirectories, each of which, in turn, contains further subdirectories, etc.

In Linux, everything is configured as a file. This includes not only text files, images and compiled programs (also referred to as executables), but also directories, partitions and hardware device drivers.

Each filesystem (used in the first sense) contains a control block, which holds information about that filesystem. The other blocks in the filesystem are inodes, which contain information about individual files, and data blocks, which contain the information stored in the individual files.

This hierarchy starts from a single directory called root, which is represented by a "/" (forward slash).

The other meaning of root is a user who has administrative privileges on the computer, in contrast to ordinary users, who have only limited privileges in order to protect system security.

All files and directories appear under the root directory, even if they are stored on different physical devices

A few of the directories defined by the Filesystem Hierarchy Standard (FHS) are /bin (command binaries for all users), /boot (boot loader files such as the kernel), /home (users home directories), /mnt (for mounting a CDROM or floppy disk), /root (home directory for the root user), /sbin (executables used only by the root user) and /usr (where most application programs get installed).

Linux File System Layout

  • /bin    ------>  Common programs, shared by the system, the system administrator and the users.
  • /boot  ------>  The startup files and the kernel, vmlinuz. In some recent distributions also grub data. Grub is the GRand Unified Boot loader and is an attempt to get rid of the many different boot-loaders we know today.
  • /dev    ------> Contains references to all the CPU peripheral hardware, which are represented as files with special properties.
  • /etc     ------> Most important system configuration files are in /etc, this directory contains data similar to those in the Control Panel in Windows
  • /home  ------> Home directories of the common users.
  • /initrd  ------> Information for booting. Do not remove!
  • /lib  ------> Library files, includes files for all kinds of programs needed by the system and the users.
  • /lost+found  ------> Every partition has a lost+found in its upper directory. Files that were saved during failures are here.
  • /misc  ------> For miscellaneous purposes.
  • /mnt  ------> Standard mount point for external file systems, e.g. a CD-ROM or a digital camera.
  • /opt  ------> Typically contains extra and third party software.
  • /proc  ------> A virtual file system containing information about system resources. More information about the meaning of the files in proc is obtained by entering the command man proc in a terminal window. The file proc.txt discusses the virtual file system in detail.
  • /root  ------> The administrative user's home directory. user.
  • /sbin  ------> Programs for use by the system and the system administrator.
  • /tmp  ------> Temporary space for use by the system, cleaned upon reboot, so don't use this for saving any work!
  • /usr  ------> Programs, libraries, documentation etc. for all user-related programs.
  • /var  ------> Storage for all variable files and temporary files created by users, such as log files, the mail queue, the print spooler area, space for temporary storage of files downloaded from the Internet, or to keep an image of a CD before burning it.