Wednesday, July 10, 2013

Linux File system

What is a UNIX/Linux File system?
A UNIX file system is a collection of files and directories stored. Each file system is stored in a separate whole disk partition. The following are a few of the file system:

  • / - Special file system that incorporates the files under several directories including /dev, /sbin, /tmp etc
  • /usr - Stores application programs
  • /var - Stores log files, mails and other data
  • /tmp - Stores temporary files

Exploring Linux File System Hierarchy

A typical Linux system has the following directories:

  • / : This is the root directory.
  • /bin : This directory contains executable programs which are needed in single user mode and to bring the system up or repair it.
  • /boot : Contains static files for the boot loader. This directory only holds the files which are needed during the boot process.
  • /dev : Special or device files, which refer to physical devices such as hard disk, keyboard, monitor, mouse and modem etc
  • /etc : Contains configuration files which are local to the machine. Some larger software packages, like Apache, can have their own subdirectories below /etc i.e. /etc/httpd. Some important subdirectories in /etc:
  • /home : Your sweet home to store data and other files. However in large installation yhe structure of /home directory depends on local administration decisions.
  • /lib : This directory should hold those shared libraries that are necessary to boot the system and to run the commands in the root filesystem.
  • /lib64 : 64 bit shared libraries that are necessary to boot the system and to run the commands in the root filesystem.
  • /mnt : This directory contains mount points for temporarily mounted filesystems
  • /opt : This directory should contain add-on packages such as install download firefox or static files
  • /proc : This is a mount point for the proc filesystem, which provides information about running processes and the kernel.
  • /root : This directory is usually the home directory for the root user.
  • /sbin : Like /bin, this directory holds commands needed to boot the system, but which are usually not executed by normal users, root/admin user specific commands goes here.
  • /tmp : This directory contains temporary files which may be deleted with no notice, such as by a regular job or at system boot up.
  • /usr : This directory is usually mounted from a separate partition. It should hold only sharable, read-only data, so that it can be mounted by various machines run ning Linux (useful for diskless client or multiuser Linux network such as university network). Programs, libraries, documentation etc. for all user-related programs.
  • /var : This directory contains files which may change in size, such as spool and log files.
  • /lost+found : Every partition has a lost+found in its upper directory. Files that were saved during failures are here, for e.g ext2/ext3 fsck recovery.
  • /etc/skel : When a new user account is created, files from this directory are usually copied into the user’s home directory.
  • /etc/X11 : Configuration files for the X11 window system.
  • /etc/sysconfig : Important configuration file used by SysV script stored in /etc/init.d and /etc.rcX directories
  • /etc/cron.* : cron daemon configuration files which is used to execute scheduled commands


Common Linux log files name and usage
* /var/log/message: General message and system related stuff
* /var/log/auth.log: Authenication logs
* /var/log/kern.log: Kernel logs
* /var/log/cron.log: Crond logs (cron job)
* /var/log/maillog: Mail server logs
* /var/log/qmail/ : Qmail log directory (more files inside this directory)
* /var/log/httpd/: Apache access and error logs directory
* /var/log/lighttpd: Lighttpd access and error logs directory
* /var/log/boot.log : System boot log
* /var/log/mysqld.log: MySQL database server log file
* /var/log/secure: Authentication log
* /var/log/utmp or /var/log/wtmp : Login records file
* /var/log/yum.log: Yum log files

Go to /var/logs directory:#
$cd /var/logsView common log file /var/log/messages using any one of the following command:
$ tail -f /var/log/messages
$ less /var/log/messages
$ more -f /var/log/messages
$ vi /var/log/messagesOutput:

File Type field: The first character in the ls -l command field indicates a file type of one of the following:
* d = directory.
* l = symbolic link.
* s = socket – sockets are special files offering a type of network interface.
* p = named pipe – handling other programme other than kernel driver.
* - = regular file.
* c= character (unbuffered) device file special.
* b=block (buffered) device file special.
* D=door A door is a special file for inter-process communication between a client and server.

No comments:

Post a Comment