Wednesday 16 May 2012

Linux Directory structure

A simple description of the UNIX system, also applicable to Linux, is this:

"On a UNIX system, everything is a file; if something is not a file, it is a process."

This statement is true because there are special files that are more than just files (named pipes and sockets, for instance), but to keep things simple, saying that everything is a file is an acceptable generalization. A Linux system, just like UNIX, makes no difference between a file and a directory, since a directory is just a file containing names of other files. Programs, services, texts, images, and so forth, are all files. Input and output devices, and generally all devices, are considered to be files, according to the system.

Unix & Linux File System

 Linux File system

  /Root

  • Every single file and directory starts from the root directory.
  • Only root user has write privilege under this directory.
  • To Remember:  /root is root user’s home directory, which is not same as /.

  /bin – User Binaries

  • Contains binary executables.
  • Commands used by all the users of the system are located here.

/sbin – System Binaries

  • It also contains executables binary.
  • The linux commands located under this directory are used typically by system aministrator, for system maintenance purpose.

 /etc – Configuration Files

  • It contains configuration files required by all programs.
  • This also contains startup and shutdown shell scripts used to start/stop individual programs.
  • For example: /etc/resolv.conf, /etc/logrotate.conf

 /dev – Device Files

  • Contains device files.
  • These include terminal devices, usb, or any device attached to the system.
  • For example: /dev/tty1, /dev/usbmon0

/proc – Process Information

  • Contains information about system process.
  • This is a virtual filesystem with text information about system resources. For example: /proc/uptime

/var – Variable Files

  • This includes — system log files (/var/log); packages and database files (/var/lib); emails (/var/mail); print queues (/var/spool); lock files (/var/lock).

/tmp – Temporary Files

  • Directory that contains temporary files created by system and users.
  • To Remember: Files under this directory are deleted when system is rebooted.

/usr – User Programs

  • Contains binaries, libraries, documentation, and source-code for programs.
  • /usr/lib contains libraries for /usr/bin and /usr/sbin
  • /usr/local contains users programs that you install from source. For example, when you install apache from source, it goes under /usr/local/apache2

 /home – Home Directories

  • Home directories for all users to store their personal files.
  • For example: /home/jack, /home/shiv

/boot – Boot Loader Files

  • Contains boot loader related files.
  • Kernel initrd, vmlinux, grub files are located under /boot
  • For example: initrd.img-2.6.32-24-generic, vmlinuz-2.6.32-24-generic

/lib – System Libraries

  • Contains library files that supports the binaries located under /bin and /sbin

/opt – Optional for Applications

  • add-on applications should be installed under either /opt.

/mnt – Mount Directory

  • Temporary mount directory where sysadmins can mount filesystems.

 /media – Removable Media Devices

  • Temporary mount directory for removable devices.
  • For examples, /media/cdrom for CD-ROM; /media/floppy for floppy drives; /media/cdrecorder for CD writer.

0 comments:

Post a Comment

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | coupon codes