

{"id":109677,"date":"2022-06-17T09:00:52","date_gmt":"2022-06-17T03:30:52","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=109677"},"modified":"2022-06-17T11:25:27","modified_gmt":"2022-06-17T05:55:27","slug":"directories-in-linux","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/directories-in-linux\/","title":{"rendered":"Directories in Linux"},"content":{"rendered":"<p>In this article, you will learn all there is to the directories in Linux-based operating systems. We will be going through each of the directories in the root directory and also looking at what they contain. We will also be looking at some miscellaneous directories important to the system. In the end, we will briefly look into the commands that help in managing these directories.<\/p>\n<h3>What is a directory?<\/h3>\n<p>A directory is a folder. With that said, we could finish up this section. I mean there is literally nobody on earth who would not know what a folder is, both literally and in operating systems.<\/p>\n<p>Just like Windows and macOS have folders, Linux has directories. A directory or folder contains different files or even subdirectories.<\/p>\n<h3>Different files in the Linux file system<\/h3>\n<p>Before we explore directories more, let&#8217;s take a moment and have an overview of the main file types in the Linux file system.<\/p>\n<h4>1. Regular files<\/h4>\n<p>This type is the most common file type in the Linux file system. regular files contain program instructions human-readable text and ASCII characters.<\/p>\n<p>Some examples of regular files are simple text files PDF files zipped or compressed files binary files or other files like \u201c.png\u201d,\u201d.mp4\u201d, \u201cjpeg\u201d, \u201c.gif\u201d, and many more.<\/p>\n<h4>2. Special files<\/h4>\n<p>Special files are the files that represent physical devices for any input and output devices like printers, CD drives, keyboards, mice, etc.<\/p>\n<h4>3. Directories<\/h4>\n<p>directory basically means folder and works just like the folders that are present in the Windows operating system. a directory is a special type of file that stores both regular and special files in a hierarchical order. this hierarchy starts from the root directory which is denoted by a slash (\/).<\/p>\n<p>let us take a look at the hierarchy of the directories in the Linux file system. if I navigate to the root directory using the \u201ccd ..\u201d command (which we will learn later) and use the LS command (which we shall learn later) to list the directories in the root directory I will get the following output:<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/05\/directories-under-root-directory.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-109760\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/05\/directories-under-root-directory.webp\" alt=\"directories under root directory\" width=\"1016\" height=\"137\" \/><\/a><\/p>\n<p>All of the files that are in dark blue color are the already prepackaged directories, and the directories shown in other different colors Are the directories I created later on.<\/p>\n<p>Our topic of interest in this article is directories, so let us forget the remaining 2 and focus on directories<\/p>\n<p>Anyway, the folders which are in the reboot directory are:<\/p>\n<p>1. \u201croot\u201d directory<\/p>\n<p>2. \u201c\/dev\u201d directory<\/p>\n<p>3. \u201c\/boot\u201d directory<\/p>\n<p>4. \u201c\/usr\u201d directory<\/p>\n<p>5. \u201c\/var\u201d directory<\/p>\n<p>6. \u201c\/etc\u201d directory<\/p>\n<p>7. \u201c\/home\u201d directory<\/p>\n<p>8. \u201c\/opt\u201d directory<\/p>\n<p>9. \u201c\/media\u201d directory<\/p>\n<p>10. \u201c\/proc\u201d directory<\/p>\n<p>11. \u201c\/bin\u201d directory<\/p>\n<p>12. \u201c\/lib\u201d directory<\/p>\n<p>13. \u201c\/mnt\u201d directory<\/p>\n<p>Let us look at each of the directories in detail<\/p>\n<h3>1. Linux root directory<\/h3>\n<p>To root directory is exactly like the C folder on windows systems. The root directory is denoted by a slash \u201c\/\u201d, that is why any path on Linux starts with a \u201c\/\u201d, just like most paths on windows start with \u201cC:\\\u201d.<\/p>\n<p>You must also note that Linux does not have any other drivers like windows has D, E, and F. The root directory contains all of the programs and applications of the machine.<\/p>\n<h3>2. Linux bin directory<\/h3>\n<p>The bin directory contains all 0f the essential user essential binaries or programs that are needed when the system is mounted in single-user mode. Important system programs and utilities such as the bash shell are located in the \u201c\/bin\u201d directory whereas applications like Firefox and LibreOffice are stored in the \u201c\/usr\/bin\u201d directory.<\/p>\n<h3>3. Linux boot directory<\/h3>\n<p>This directory contains all the files needed to boot the system like boot loader\u2019s files, Linux kernels, the set of vmlinuz, initrd, system map, GRUB, etc. This is one of the most important directories because it conta9ns all of the files the operating system needs for it to boot. However, the configuration files of the boot loader aren\u2019t stored here (they are in the \u201c\/etc\u201d directory)<\/p>\n<h3>4. Linux cdrom directory<\/h3>\n<p>The cdrom directory is not part of the file hierarchy system (FSH), nonetheless, you will still find it on most Linux-based operating systems. This directory is a temporary location for CD-ROMs inserted into the system. Though the more defined and standard location for temporary media is inside the \u201c\/media\u201d directory.<\/p>\n<h3>5. Linux dev directory<\/h3>\n<p>The dev directory contains a number of special files that represent different devices, these are technically not files, but at least appear to be. For example, the sda file in the dev directory represents the SATA drivers.<\/p>\n<p>If you want to partition the SATA drive in the system, you can start a partition and tell it to edit \u201c\/dev\/sda\u201d.<\/p>\n<p>The dev directory apart from containing the folders and files related to devices also contains pseudo-devices, which are virtual devices that actually don\u2019t correspond to the hardware. Like the file \/dev\/random produces random numbers and \/dev\/null (a weird device) produces np output and automatically deletes all input.<\/p>\n<h3>6. Linux etc directory<\/h3>\n<p>The etc directory contains the configuration files of the system. These configuration files can generally be edited by hand in a text editor. It must be noted that the etc directory contains only system-wide configuration files and the user configuration files are stored in the user&#8217;s home directory.<\/p>\n<h3>7. Linux home directory<\/h3>\n<p>Home, sweet home, this is where all the pieces of information about the users in the computer are stored. This directory contains a home folder for every user on the PC. It contains all user data and user-specific configuration files.<\/p>\n<p>Each user can access and modify their own home folder and must have elevated permissions (or sudo privileges) if they wish to modify other user files on the system.<\/p>\n<h3>8. Linux lib directory<\/h3>\n<p>This directory contains all the libraries needed by the essential binaries in the directories \u201c\/bin\u201d and \u201c\/sbin\u201d.<br \/>\nWe can also find the kernel modules and shared files needed for the boot operation of the system in the lib directory. The kernel modules can be found in the subdirectory \u201c\/lib\/modules\/&lt;kernelversion&gt;\u201d and the libraries needed by the binaries in the path \u201c\/usr\/bin\u201d are located in \u201c\/usr\/lib\u201d<\/p>\n<h3>9. Linux lost + found directory<\/h3>\n<p>The lost + found directory contains corrupted files. When a file system crashes, the file system runs a check at the next boot, since the corrupted files are stored in the lost + found directory, you can attempt to recover as much data as possible.<\/p>\n<h3>10. Linux media directory<\/h3>\n<p>This directory contains the subdirectories where removable media devices which are inserted into the computer are mounted. For example, when you insert a CD into your computer with a Linux-based operating system, a directory will automatically be created in the media directory, where you can access the contents of the CD.<\/p>\n<h3>11. Linux mnt directory<\/h3>\n<p>The mount or mnt directory is where system administrators mounted temporary file systems while using them. The process of making a file system available to the operating system is called mounting.<\/p>\n<p>Note that some Linux distributions like Debian allocate \/floppy and \/cdrom as mount points whereas other distros like RHEL put them in \/mnt\/floppy and \/mnt\/cdrom.<\/p>\n<h3>12. Linux opt directory<\/h3>\n<p>The optional or opt directory contains the subdirectories for optional software packages. It is the directory where usually manually installed software and add-on packages from vendors are stored.<\/p>\n<p>This directory is commonly used by propriety software that doesn\u2019t obey the standard hierarchy of the filesystem. For example, some arbitrary proprietary program might dump its files in the path \u201c\/opt\/application\u201d when you install it.<\/p>\n<h3>13. Linux proc directory<\/h3>\n<p>The proc directory is very much similar to the dev directory as it does not contain standard files. This directory contains special files that represent the system process and information.<\/p>\n<h3>14. Linux run directory<\/h3>\n<p>This directory gives applications a standard place to store transient files they require (like process ID and sockets). These files cannot be stored in the directory \/tmp because tmp might delete them, since tmp stores only temporary files for a specif time period.<\/p>\n<h3>15. Linux sbin directory<\/h3>\n<p>The sbin directory is very similar to the bin directory. This directory contains the essential binaries that are intended to be run either by the system administrator or root user.<\/p>\n<h3>16. SELinux directory<\/h3>\n<p>If you use Security enhanced Linux for security, the special files used by SE Linux are stored in the directory \u201c\/selinux\u201d<\/p>\n<h3>17. Linux srv directory<\/h3>\n<p>The service or srv directory contains the data for the services provided by the system. For example, if you are using the Apache HTTP server to serve a website, you would store the files related to the website in a subdirectory inside the \u201c\/srv\u201d directory.<\/p>\n<h3>18. Linux temp directory<\/h3>\n<p>The temp directory stores temporary files of applications and programs. For example, say you are writing a document in LibreOffice, it automatically saves a temporary copy in the temp directory. This directory is usually emptied when you reboot the system.<\/p>\n<h3>19. Linux usr directory<\/h3>\n<p>The user directory contains the applications and files that are used by the users in the system. You must not that only those files used by the user will be stored here and not the ones used by the system.<\/p>\n<p>This directory is one of the most important directories as it contains all of the user binaries, files, libraries, documentation, applications and so many more.<\/p>\n<p>The applications installed in this directory are considered non-essential for the basic operation of the system. The usr directory also contains other directories like architecture-independent files like graphics are located in the \u201c\/usr\/share\u201d directory.<\/p>\n<h3>20. Linux var directory<\/h3>\n<p>The var directory is the writable counterpart to the usr directory. Let us look at the different subdirectories in the var directory and what they store.<\/p>\n<p>1. \/var\/crash<\/p>\n<p>This subdirectory holds information about processes that have crashed<\/p>\n<p>2. \/var\/mail<\/p>\n<p>This subdirectory Contains user mailbox files<\/p>\n<p>3. \/var\/log<\/p>\n<p>This subdirectory contains log files for both the system and other different applications.<\/p>\n<p>4. \/var\/lib<\/p>\n<p>This subdirectory contains dynamic data files\/libraries.<\/p>\n<p>5. \/var\/spool<\/p>\n<p>This subdirectory spool data of applications<\/p>\n<p>Now that you have seen all of the main useful directories in the root directory, let us take a brief look at how to manage directories in Linux using the terminal.<\/p>\n<h3>Managing directories from the terminal<\/h3>\n<p>We all know that there are 2 ways to do almost anything in Linux, one is the GUI and the other is the terminal. In this section, we are going to see how to manage directories using different commands in the terminal like pwd, ls, mkdir, rmdir and ch.<\/p>\n<p>You may ask why use the terminal when the GUI is good enough? Well, Linux is not about being \u2018good enough and the terminal makes management of the Linux filesystem so much more faster, simple and efficient.<\/p>\n<p>If you really want to get a really good and full-blown idea of how these commands are a 100% better than the GUI, you can read my article on managing the filesystem of Linux through the kernel.<\/p>\n<p>Let us look at the commands that help in managing directories in Linux:<\/p>\n<h3>Linux PWD command<\/h3>\n<p>The PWD command is an abbreviation for \u201cPresent Working Directory\u201d. This command is very straightforward and simple, it prints out the path of your current directory, starting all the way from the root directory.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/05\/pwd-command.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-109761\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/05\/pwd-command.webp\" alt=\"pwd command\" width=\"565\" height=\"347\" \/><\/a><\/p>\n<h3>Linux CD command<\/h3>\n<p>The \u201ccd\u201d command is used to navigate through the files. Just like in GUI, you press the directory you want to go to, cd does the same, but in the terminal. The cd command is the abbreviation for \u2018Change Directory\u2019.<\/p>\n<p>If you simply type \u2018cd\u2019, you will go back to the home directory, no matter where you are.<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/05\/cd-command-in-linux.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-109759\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/05\/cd-command-in-linux.webp\" alt=\"cd command in linux\" width=\"535\" height=\"165\" \/><\/a><\/p>\n<p>If you press \u201ccd ..\u201d, this command will take you to the previous directory or parent directory. You can go all the way back to the root directory using this command.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/05\/linux-cd-command.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-109763\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/05\/linux-cd-command.webp\" alt=\"linux cd command\" width=\"478\" height=\"346\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Ok, we have seen how to go to the home directory and how to go back, but how do you go forward, well once you are in a directory, you can simply type the command \u201ccd &lt;subdirectory&gt;\u201d. This command will take you to the subdirectory you have specified.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/05\/cd-command.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-109762\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/05\/cd-command.webp\" alt=\"cd command\" width=\"546\" height=\"404\" \/><\/a><\/p>\n<p>If you look at the above method of going to the directory \u2018cars\u2019 from the root directory, it is a very long process, I had to use the cd command 4 times. The previous method was on par with the GUI, where you go to the directory and press on the subdirectory.<\/p>\n<p>However, remember when I said the terminal is all about efficiency? Well, there is a way you can even go 100 directories deep from the home directory just by using 1 single cd command! You can do so by using the following syntax: \u201ccd &lt;directory path&gt;\u201d If you specify the path of the directory to cd, it will take you directly there with not additional stops in between.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/05\/cd-command-linux.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-109758\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/05\/cd-command-linux.webp\" alt=\"cd command linux\" width=\"825\" height=\"191\" \/><\/a><\/p>\n<p>Take that GUI!!<\/p>\n<h3>Linux MKDIR command<\/h3>\n<p>We learned how to create file, it is only fair to learn how to make directories too. To make directories we uses the mkdir command with the following syntax: mkdir &lt;name of directory&gt;. The mkdir command is an abbreviation for Make Directory.<\/p>\n<p>To make a directory in a specific parent directory, you must first be there.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/05\/mkdir-command.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-109766\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/05\/mkdir-command.webp\" alt=\"mkdir command\" width=\"802\" height=\"163\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>If you feel lazy to go to that specific directory to create a subdirectory in it, you can create a directory anywhere, just by writing its path, nomatter where you are (in the computer).<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/05\/mkdir-linux.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-109764\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/05\/mkdir-linux.webp\" alt=\"mkdir linux\" width=\"1046\" height=\"192\" \/><\/a><\/p>\n<p>In the above output, I created the directory \u201cBMW_pictures\u201d in the path \u201c\/home\/gopikiran\/Desktop\/cars\u201d even though I was in the path \u201c\/home\/gopikiran\/Desktop\/DataFlair\u201d (different directories).<\/p>\n<h3>Linux RMDIR command<\/h3>\n<p>Need to remove a created directory, rmdir does just that. Rmdir is the abbreviation for Remove Directory. It functions exactly like the mkdir command.<\/p>\n<p>If you simply used the syntax: rmdir &lt;directory name&gt;, you will remove the directory with that specific name, only if it is there in the directory you are currently in.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/05\/rmdir-command.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-109767\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/05\/rmdir-command.webp\" alt=\"rmdir command\" width=\"708\" height=\"145\" \/><\/a><\/p>\n<p>If you use the syntax: rmdir &lt;path of directory&gt;, you will remove that specified directory regardless of which directory you are currently in.<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/05\/linux-rmdir-command.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-109768\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/05\/linux-rmdir-command.webp\" alt=\"linux rmdir command\" width=\"1070\" height=\"199\" \/><\/a><\/p>\n<p>In the above output, I removed the directory \u201cBMW_pictures\u201d in the path \u201c\/home\/gopikiran\/Desktop\/cars\u201d even though I was in the path \u201c\/home\/gopikiran\/Desktop\/DataFlair\u201d (different directories).<\/p>\n<h3>Linux LS command<\/h3>\n<p>Ok, now you can check your present working directory and navigate through the files. But what if you need to list out the files or subdirectories present in a directory? That is exactly where the ls command comes to help. The ls command stands for \u201clist\u201d<\/p>\n<p>To list the contents of a directory, you can simply use the ls command:<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/05\/ls-command-1.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-109769\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/05\/ls-command-1.webp\" alt=\"ls command\" width=\"1014\" height=\"210\" \/><\/a><\/p>\n<p>The ls command is a very powerful command with so many options that the GUI can barely even touch! If you want to see the full usage of the LS command along with its different options, you can read my article on the LS command.<\/p>\n<h3>Exploring more files!<\/h3>\n<p>Before we call it a day, let us look at some more files and what they store in it that are useful to th system. We know by now that everything in Linux is a file and the Linux operating system is a very complex filesystem. Let us at least try to scratch the surface of this filesystem by taking a brief look at some of the important files in the Linux file system:<\/p>\n<h4>System Configuration Files:<\/h4>\n<p><strong>1. \/etc\/bashrc<\/strong><\/p>\n<p>This file contains system defaults and aliases.<\/p>\n<p><strong>2. \/etc\/crontab<\/strong><\/p>\n<p>This file contains the files related to crontab (like cronjobs)<\/p>\n<p><strong>3. \/etc\/exports<\/strong><\/p>\n<p>This file contains the information on the file system available on the network.<\/p>\n<p><strong>4. \/etc\/fstab<\/strong><\/p>\n<p>This file contains the information about the Disk Drive and its mount point.<\/p>\n<p><strong>5. \/etc\/group<\/strong><\/p>\n<p>This file contains the information of the Security Group.<\/p>\n<p><strong>6. \/etc\/grub.conf<\/strong><\/p>\n<p>This file contains the grub bootloader configuration file.<\/p>\n<p><strong>7. \/etc\/init.d<\/strong><\/p>\n<p>This file contains the service startup script.<\/p>\n<p><strong>8. \/etc\/lilo.conf<\/strong><\/p>\n<p>This file contains the configuration file of the lilo bootloader.<\/p>\n<p><strong>9. \/etc\/hosts<\/strong><\/p>\n<p>This file contains the Information of IP and corresponding hostnames.<\/p>\n<p><strong>10. \/etc\/hosts.allow<\/strong><\/p>\n<p>This file contains a list of hosts allowed to access services on the local machine.<\/p>\n<p><strong>11. \/etc\/host.deny<\/strong><\/p>\n<p>This file contains the list of hosts denied to access services on the local machine.<\/p>\n<p><strong>12. \/etc\/inittab<\/strong><\/p>\n<p>This file contains the INIT process and their interaction at the various run level.<\/p>\n<p><strong>13. \/etc\/modules.conf<\/strong><\/p>\n<p>This file contains the configuration files for the system modules.<\/p>\n<p><strong>14. \/etc\/motd<\/strong><\/p>\n<p>This file contains the message of the day.<\/p>\n<p><strong>15. \/etc\/passwd<\/strong><\/p>\n<p>This file contains the username, password of the system, and users in a shadow file.<\/p>\n<p><strong>16. \/etc\/printcap<\/strong><\/p>\n<p>This file contains printer Information.<\/p>\n<p><strong>17. \/etc\/profile<\/strong><\/p>\n<p>This file contains bash shell defaults.<\/p>\n<p><strong>18. \/etc\/profile.d<\/strong><\/p>\n<p>This file contains other scripts like application scripts, executed after login.<\/p>\n<p><strong>19. \/etc\/rc.d<\/strong><\/p>\n<p>This file avoids script duplication.<\/p>\n<p><strong>20. \/etc\/rc.d\/init.d<\/strong><\/p>\n<p>This file runs Level Initialisation Script.<\/p>\n<p><strong>21. \/etc\/security<\/strong><\/p>\n<p>This file contains the name of terminals where root login is possible.<\/p>\n<p><strong>22. \/etc\/X11<\/strong><\/p>\n<p>This file contains all the conf files for the X-window System.<\/p>\n<p><strong>23. \/etc\/termcap<\/strong><\/p>\n<p>This file defines the behavior of different types of terminals.<\/p>\n<p><strong>24. \/etc\/skel<\/strong><\/p>\n<p>This file initiates a new user home directory.<\/p>\n<h4>Linux kernel file:<\/h4>\n<p><strong>1. \/boot\/vmlinux<\/strong><\/p>\n<p>This file contains the Linux kernel file.<\/p>\n<h4>Version information file:<\/h4>\n<p><strong>1. \/version<\/strong><\/p>\n<p>This file contains the information about the Linux version.<\/p>\n<h4>Device Files:<\/h4>\n<p><strong>1. \/dev\/hda<\/strong><\/p>\n<p>This file contains the device file for the first IDE HDD.<\/p>\n<p><strong>2. \/dev\/hdc<\/strong><\/p>\n<p>This file contains the pseudo-device that output garbage output is redirected to \/dev\/null.<\/p>\n<h4>Log files:<\/h4>\n<p><strong>1. \/var\/log\/lastlog<\/strong><\/p>\n<p>This file stores the user&#8217;s last login info.<\/p>\n<p><strong>2. \/var\/log\/messages<\/strong><\/p>\n<p>This file contains all the global system messages.<\/p>\n<p><strong>3. \/var\/log\/wtmp<\/strong><\/p>\n<p>This file keeps a history of login and logout information.<\/p>\n<h4>User related files<\/h4>\n<p><strong>1. \/usr\/bin<\/strong><\/p>\n<p>This file contains most of the executable files.<\/p>\n<p><strong>2. \/usr\/bin\/X11<\/strong><\/p>\n<p>This file contains the symbolic link of \/usr\/bin.<\/p>\n<p><strong>3. \/usr\/include<\/strong><\/p>\n<p>This file contains the standard include files used by the C program.<\/p>\n<p><strong>4. \/usr\/share<\/strong><\/p>\n<p>This file contains architecture-independent shareable text files.<\/p>\n<p><strong>5. \/usr\/lib<\/strong><\/p>\n<p>This file contains the object files and libraries.<\/p>\n<p><strong>6. \/usr\/sbin<\/strong><\/p>\n<p>This file contains the commands for Super User, for System Administration.<\/p>\n<h4>Pseudo process and virtual related files:<\/h4>\n<p><strong>1. \/proc\/cpuinfo<\/strong><\/p>\n<p>This file contains the information about the CPU.<\/p>\n<p><strong>2. \/proc\/filesystems<\/strong><\/p>\n<p>This file information about the processes that are running currently.<\/p>\n<p><strong>3. \/proc\/interrupts<\/strong><\/p>\n<p>This file contains information about the number of interrupts per IRQ.<\/p>\n<p><strong>4. \/proc\/ioports<\/strong><\/p>\n<p>This file contains all the Input and Output addresses used by devices on the server.<\/p>\n<p><strong>5. \/proc\/meminfo<\/strong><\/p>\n<p>This file contains information about memory usage.<\/p>\n<p><strong>6. \/proc\/modules<\/strong><\/p>\n<p>This file contains the kernel modules.<\/p>\n<p><strong>7. \/proc\/mount<\/strong><\/p>\n<p>This file contains information about the mounted File-system.<\/p>\n<p><strong>8. \/proc\/stat<\/strong><\/p>\n<p>This file contains information about the statistics of the current system.<\/p>\n<p><strong>9. \/proc\/swaps<\/strong><\/p>\n<p>This file contains information about swap files.<\/p>\n<h3>Summary<\/h3>\n<p>You have now learned, what a directory is and the different directories present in the root directory. You have also learned the different commands like PWD, CD, MKDIR, RMDIR, and LS for managing directories from the kernel, without using the GUI.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, you will learn all there is to the directories in Linux-based operating systems. We will be going through each of the directories in the root directory and also looking at what&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":109756,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35],"tags":[26951,26952,26955,26954,26953],"class_list":["post-109677","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-directories-in-linux","tag-linux-directory-structure","tag-linux-mkdir-command","tag-linux-rmdir-command","tag-linux-root-directory"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Directories in Linux - DataFlair<\/title>\n<meta name=\"description\" content=\"Learn about linux directories, directories in root directory &amp; what they contain. See some miscellaneous directories important to the system.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/directories-in-linux\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Directories in Linux - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Learn about linux directories, directories in root directory &amp; what they contain. See some miscellaneous directories important to the system.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/directories-in-linux\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-06-17T03:30:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-17T05:55:27+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/05\/directories-in-linux.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"16 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Directories in Linux - DataFlair","description":"Learn about linux directories, directories in root directory & what they contain. See some miscellaneous directories important to the system.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/directories-in-linux\/","og_locale":"en_US","og_type":"article","og_title":"Directories in Linux - DataFlair","og_description":"Learn about linux directories, directories in root directory & what they contain. See some miscellaneous directories important to the system.","og_url":"https:\/\/data-flair.training\/blogs\/directories-in-linux\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2022-06-17T03:30:52+00:00","article_modified_time":"2022-06-17T05:55:27+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/05\/directories-in-linux.webp","type":"image\/webp"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"16 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/directories-in-linux\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/directories-in-linux\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/b49855299264df5e27e3ec6c2cd9fde9"},"headline":"Directories in Linux","datePublished":"2022-06-17T03:30:52+00:00","dateModified":"2022-06-17T05:55:27+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/directories-in-linux\/"},"wordCount":3159,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/directories-in-linux\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/05\/directories-in-linux.webp","keywords":["Directories in Linux","linux directory structure","Linux MKDIR command","Linux RMDIR command","linux root directory"],"articleSection":["Linux Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/directories-in-linux\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/directories-in-linux\/","url":"https:\/\/data-flair.training\/blogs\/directories-in-linux\/","name":"Directories in Linux - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/directories-in-linux\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/directories-in-linux\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/05\/directories-in-linux.webp","datePublished":"2022-06-17T03:30:52+00:00","dateModified":"2022-06-17T05:55:27+00:00","description":"Learn about linux directories, directories in root directory & what they contain. See some miscellaneous directories important to the system.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/directories-in-linux\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/directories-in-linux\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/directories-in-linux\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/05\/directories-in-linux.webp","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/05\/directories-in-linux.webp","width":1200,"height":628,"caption":"directories in linux"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/directories-in-linux\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Linux Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/linux\/"},{"@type":"ListItem","position":3,"name":"Directories in Linux"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/b49855299264df5e27e3ec6c2cd9fde9","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/ef46b745ddad2fad690af626c6ef29b91809ad0a9f5ef398d07817d8cad042f5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/ef46b745ddad2fad690af626c6ef29b91809ad0a9f5ef398d07817d8cad042f5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ef46b745ddad2fad690af626c6ef29b91809ad0a9f5ef398d07817d8cad042f5?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team is a group of passionate educators and industry experts dedicated to providing high-quality online learning resources on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. With years of experience in the field, the team aims to simplify complex topics and help learners advance their careers. At DataFlair, we believe in empowering students and professionals with the knowledge and skills needed to thrive in today\u2019s fast-paced tech industry. Follow us for Free courses, expert insights, tutorials, and practical tips to boost your learning journey.","url":"https:\/\/data-flair.training\/blogs\/author\/datafbdad\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/109677","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=109677"}],"version-history":[{"count":2,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/109677\/revisions"}],"predecessor-version":[{"id":109770,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/109677\/revisions\/109770"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/109756"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=109677"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=109677"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=109677"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}