Tuesday, July 12, 2011

Files and Directories 

Linux files are organised in logical fashion for ease of administration. File system acts as a large container contianing hundreds of directories. Linux follows FHS standard ( Filesystem Hierarchy Standard ). 

There are 2 types of file systems -- Disk based and memory based. 
Disk based filesystem are usually created on HDD. 
Memory based filesystem are usually virtual and gets destroys once the system reboots. 
There are 2 types of data : Static and Dynamic 
Static : Data which doesnot change on system like configuration files, binaries, device Files, kernel files, 
Dynamic : Data which keeps on changing log files, status files, temp files etc. 

Filesystem Hierarchy :  

                     /
                     |
 +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+---
 |     |     |     |     |     |      |       |        |     |     |     |      |     |
bin sbin  usr lib  root boot home  tmp   var  opt  dev  mnt  etc  proc
             |                                                     |
             |                                                  +-------+
  +------+----+-----+-----+-----+-----+             |         |
  |        |    |     |           |     |     |               cdrom   floppy
include src  lib  share  bin   sbin  local
                    |                   |
               +----+----+         +-----+
               |    |       |           |     |
             info  man  doc       bin   sbin
                    |
                 +-----+
                 |     |
               man1...man9
 

A brief description of FHS ( Linux ):

/            -> "/" or "slash" contains all the other dirs in linux.
 |                          "Father of all directories".
 |
 |-- bin/        -> "/bin" contains compulsory binaries which all users
 |                          can use and without which linux will not work well.
 |
 |-- sbin/        -> "/sbin" contains compulsory binaries which only super
 |                          user can use and without which linux will not work.
 |
 |-- etc/        -> "/etc" contains all config files [ASCII/flat files]
 |
 |-- dev/        -> "/dev" contains all block and character special
 |                          device drivers.
 |
 |-- lib/        -> "/lib" contains all shared objects (.so) files.
 |                          Similar to (.dll) files in Windows.
 |
 |-- mnt/        -> "/mnt" contains dummpy dirs for mounting removable
 |   |                      devices.
 |   |
 |   |-- cdrom/        -> "/mnt/cdrom" is the mount point for CD-ROM drive.
 |   |
 |   `-- floppy/    -> "/mnt/floppy" is the mount point for floppy drive.
 |
 |-- opt/        -> "/opt" contains optional third party softwares.
 |
 |-- root/        -> "/root" is the home directory of super user.
 |
 |-- boot/        -> "/boot" contains all bootable files and the linux
 |                          kernel.
 |
 |-- home/        -> "/home" contains home directories of all users.
 |
 |-- proc/        -> "/proc" contains virtual file system i.e the linux
 |                          kernel in RAM
 |
 |-- tmp/        -> "/tmp" contains temporary files and directories.
 |                          It is like the scratch pad of the system.
 |                          Running apps use this for their temp files
 |
 |-- var/        -> "/var" contains variable files. eg. mail boxes of
 |                          users, log files.
 |
 |--lost+found/  --> This directory is used to hold up files that become orphan
 |                           after system crash. Orphan files are those who have lost 
 |                           there name. When filesystem is created its automatically 
 |                           created.If deleted can be recreated through mklost+found
 |
 |
 `-- usr/        -> "/usr" contains all installation files of linux.
     |                     
     |
     |-- bin/        -> "/usr/bin" contains optional binaries which all users
     |                      can use [3rd party binaries]
     |
     |-- sbin/        -> "/usr/sbin" contains optional binaries which only su-
     |                      per user can use  [3rd party binaries]
     |
     |-- local/                Program Files folder in Windows.
     |   |
     |   |-- bin/    -> "/usr/local/bin" contains third party binaries inst-
     |   |                  alled after installation, which all users can use.
     |   |
     |   `-- sbin/    -> "/usr/local/sbin" contains third party binaries inst-
     |                      alled after installation, which only super user can
     |                      use.
     |
     |-- include/    -> "/usr/include" - Mostly C header files, Assembler
     |                     
     |
     |-- src/        -> "/usr/src" contains the source code of the linux
     |                      kernel in a sub directory (linux-2.4.20-8) under it.
     |
     |-- lib/        -> "/usr/lib" contains all optional shared objects (.so)
     |                     
     `-- share/
         |
         |-- info/    -> "/usr/share/info" contains the Linux manual in HTML
         |
         |-- doc/    -> "/usr/share/doc/" contains the Linux Documentation
         |
         `-- man/    -> "/usr/share/man" contains the Linux Manual
         |
             `-- man1/
             `-- man2/
             `-- man3/
             `-- man4/
             `-- man5/
             `-- man6/
             `-- man7/
             `-- man8/
             `-- man9/

 
 


No comments:

Post a Comment