Monday, February 17, 2020

Linux Directory Structure

In a hierarchical inverted tree like structure, the Linux provides following directories under the /directory to store a specific type of file.

1. / – Root
    Every single file and directory starts from the root directory.    
    Only root user has write privilege under this directory.
     /root is root user’s home directory.

2. /home – Home Directories
    Contains all the HOME directories of users.
    Home directories for all users store particular user personal files.
    For example: /home/teachers, /home/students, /home/mhcollege

3. /bin – User Binaries
    Contains many utilities as binary executables.
    The utilities are common linux commands you need to use in single-user modes
    Commands used by all the users of the system are located here.
    For example: ps, ls, ping, grep, cp.

4. /dev – Device Files
    Contains device files.
    These include terminal devices, USB, or any device attached to the system.
    For example: /dev/tty1, /dev/usbmon0

5. /etc – Configuration Files
    Contains configuration files required by all programs.
    Stores system related data which users and the system need to refer.
    This also contains startup and shutdown shell scripts used to start/stop individual programs.
    For example: passwd, /etc/resolv.conf, /etc/logrotate.conf

6. /lib – System Libraries
    Contains library files for the compilers installed in the system 
    Library filenames are either ld* or lib*.so.*
    For example: ld-2.11.1.so, libncurses.so.5.7

7. /sbin – System Binaries
     Just like /bin, /sbin also contains binary executables.     
     But, the linux commands located under this directory are used by system aministrator, for system            maintenance purpose.
      For example: iptables, reboot, fdisk, ifconfig, swapon

8. /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

9. /usr – User Programs
    Contains operating system files which are not involved in the boot process. 
    /usr/bin contains binary files for user programs. For example: at, awk, cc, less, scp
    /usr/sbin contains binary files for system administrators. For example: useradd, userdel
    /usr/lib contains libraries for /usr/bin and /usr/sbin
    /usr/local contains users programs that you install from source. 

10. /var – Variable Files
    var stands for variable files.
    Content of the files that are expected to grow can be found under this directory.
     Includes system log files (/var/log); packages and database files (/var/lib); emails (/var/mail); print         queues (/var/spool); lock files (/var/lock); temp files needed across reboots (/var/tmp);

11. /tmp – Temporary Files
    Contains temporary files created by system and users.
    Files under this directory are deleted when system is rebooted.

12. /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


No comments:

Post a Comment