Linux File Systems ‘/’


In this post, we will be learning about Linux file systems which are sub directories of ‘/’

If you even have an idea of Linux, you would know, everything comes under ‘/’. While Installing, you can either divide space for each file system and install it or you can simple assign disk space to ‘/’.
The disadvantage of assigning space to each file system under ‘/’ is , if you gave home file system 10GB, it would be 10GB fixed.
However, if you assign some space to ‘/’ each file system will get dynamically allocated space.
So if you know which type of machine you will be working on, what your real job is and how much space a particular file system needs, only then go for allocating disk space for each file system.
File systems may vary according to Linux Distributions and Operating Systems. The file systems we are discussing here are of Red-Hat based Operating Systems.

File system in Fedora :D

File system in Fedora 😀

File systems under ‘/’ is where everything is stored. Windows has drives, Linux has File Systems. This file system helps makes Linux more secure and organized. Now lets check the various file sections and its uses :

  1. /bin
    – It has binary files and shells like bash, csh (C shell)etc.
    – /bin is a directory which is accessible to both, normal user and superuser.
    – Commonly used commands like cp,mv,ls,cat,rm are also in /bin.
    – /bin has soft links tocsh,netstat, ping,gzip,gunzip etc if they’re installed in your system.

    Bin directory

    Bin directory

     

  2. /boot
    – It has the file that is needed by microprocessor for the boot process.
    – It stores data, used before the kernel begins executing user programs.
    – The Linux Grub is also a sub-directory of boot!

    Boot directory!

    Boot directory!

     

  3. /dev
    – This filesystem has all the device files.
    – All the partitions of your hard disk are declare here.
    – If you ever list its content, you’ll find sub directories like cdrom, sda1, sda2, usb.
    – So if you want to make partitions in your hard disk, you will use fdisk command with /dev/sda (sda = name of hard disk).

    Dev directory.

    Dev directory.

     

  4. /etc
    – This is like the main heart of your Operating system.
    – All the system configuration files are in /etc.
    – If you installed any package,
    – It has bash, cups,csh scripts, fstab, exports basically, every important file is in /etc.

    Etc directory.

    Etc directory.

     

  5. /home
    – Home is like the ‘Users’ folder of Windows.
    – Each user has a different folder in /home.
    – All the user files are stored here.
    – Say you have user Abc, so his files would be saved in ‘/home/Abc’.

    Home directory.

    Home directory.

     

  6. /lib
    – It has the shared library images .
    – These are needed to boot the system and run the commands in the root file-system.
    – It also has the kernel modules inside /lib/modules

    Lib directory.

    Lib directory.

     

  7. /media 
    – The hard disk you’re using is here. If you need to reach it via console, you need to go in /media.
    – It is also used as mount point for removable devices.
    – If there’s a cdrom, its path in Linux would be /media/cdrom,
    – If there’s an external Hard disk named ‘Transcend’, its path would be /media/Transcend.
    – If Linux has mounted any of your device, it will be under /media.

    Media directory.

    Media directory.

     

  8. /mnt
    – Here you can mount any device manually.
    – Suppose you attach a NTFS device in FEDORA. If you don’t have ntfs-3g package, the system won’t mount it.
    – In this case, you need mount that drive manually.
    – So you can either mount it on /mnt or create a new folder and mount it inside that folder.
    – If you’re mounting manually, you can do it on any place. But suppose you chose to mount on ‘/home’ then the space of /home would be occupied by the mounted device. So a special filesystemis provided if you want to mount manually.

    Mnt directory.

    Mnt directory.

     

  9. /opt
    – This is an optional file system.
    – This directory is reserved for softwares and add-on packages that are not part of the default installation.
    – By default third-party applications like Team Viewer or Skypeare installed it.

    Opt directory.

    Opt directory.

     

  10. /proc
    – Proc can be defined as a Virtual File system.
    – It is called a virtual file system because, all the real-time information resides here.
    – When you use lspci (list pci devices), it acutally checks the real-time pci devices from proc/pci and displays it.
    – That means ‘lspci’ is actually    ‘cat /proc/pci’.
    – Other information you can get fromproc are drivers, uptime, version (Kernel version) etc.

    Proc directory.

    Proc directory.

     

  11. /root
    – This is the home directory if root.
    – If you download something from root user, you’ll see it under /root.
    – Earlier, ‘/’ was actually the home directory of root. But then to make things easier, root got its own home directory.

    Home of Root. Normal user can't see the contents.

    Home of Root. Normal user can’t see the contents.

     

  12. /sbin
    – This file system has the system binaries.
    – Files in these folder are used for system maintenance or administrative tasks.
    – This directory is only accessible to Super user and not normal user.

    System binaries.

    System binaries.

     

  13. /usr
    – /usr is a directory used for data collection.
    – /usr contains  binaries of users, their documentation, libraries, header file, supporting libraries and many more things.
    – You can also use telnet or ftp from here.

    Usr directory.

    Usr directory.

     

  14. /var
    – It has variable data.
    – Data like system logging files, mail and printer spool directories, and transient and temporary file live here.
    – It stores system logs and log files of various applications.

    Var directory.

    Var directory.

     

  15. /srv
    – /srv contains site specific data.
    – It stores files of a particular service.

    Srv directory.

    Srv directory.

     

  16. /tmp
    – All the temp files are stored here.
    – If you downloaded any tar ball, you can unzip it here.
    – /tmp is accessible to both, normal user and super user.
    – Do not delete files from here, unless you know what are the functions of those files.
    – /tmp also has important files needed, deleting them may make your system unstable or crash your system.

    Temporary files.

    Temporary files.

 

 

References : http://www.tldp.org/guides.html

Leave a Reply