Understanding Linux directory structure

Everything is so organized in Linux but when one don’t know the use and purpose of different directories in Linux it becomes messy. Following is a brief on different directories that are present in Linux and what they are used for.

Linux-directory-structure
Linux-directory-structure

/ :  is the parent directory for all the other present directories in Linux.

/root  :  This is the home directory for root user.

/bin : bin is an abbreviation of Binaries. It’s just a directory where a user of an operating system can expect to find applications for example it contains binaries for different command like cat, mv, cp, echo etc.

/boot : boot holds important files including Kernel, grub required during the Linux boot process.

/dev :  this directory contains all the special device files for all the hardware devices present on the machine for example the hard drive files sda, sdb.

/etc :  the /etc directory contains all the configuration files for all different application / services that are running on the Linux. You can find files related network, user configuration etc.

/home : this is the directory where all the users store their files (excluding root) .  Whenever a new user is created a new directory is created under /home something like this /home/boo /home/foo.

/lib : lib directory contains Linux kernel modules and the shared library images required to boot the system and run the commands in root filesystem.

/lost+found : fsck – “files system check” command checks your filesystem for broken files if it finds any such files it places them into /lost+found directory

/media : Inside media temporary mount directories are created for different removable devices like Pendrives.

/mnt : this is used for temporary mounting of file system.

/opt : this is an abbreviation of Optional. It contains third party applications like java etc.

/proc : this is a process information pseudo-file system. It contains runtime system information such as system memory, devices mounted, hardware configuration, etc

/run : there are services and daemons that run very early during the startup process, /run is a standardized file system location available where they can store runtime information.

/sbin : Same as /bin this directory also contains executable binaries / commands but these commands are related to system administration and can’t be executed by normal users.

/sys : this is a virtual file system which stores and allows modification of the devices connected to the system.

/tmp : This is the directory where different temporary files are stored and in some distributions deleted on system reboot. This directory has Sticky bit permission to it which means any user can create the files / directories but they can only modify be modified by owner or root.

/usr : it contains all the user binaries, their documentation, libraries, header files, etc. User programs like telnet, ftp, etc are also placed here.

/var : var stands for variable the size of files here is expected to grow. It contains log files backup files etc.

Leave a Reply

Your email address will not be published. Required fields are marked *