0 0
Read Time:4 Minute, 12 Second

We can compare a filesystem to a refrigerator, or any other storage with multiple shelves that is used for storing different items. These shelves or compartments help us to organize grocery items in our refrigerator by certain characteristics, such as shape, size, type, and so on. The same analogy is applicable to a filesystem, which is the epitome of storing and organizing collections of data and files in human-usable form.

A filesystem is organized in an inverted root tree design with /(a forward slash; pronounced root) as the root of the filesystem, and underneath /, we see therest of the directories and subdirectories, as shown in the following diagram:

Important filesystem directories in CentOS 

This layout of the filesystem hierarchy is described in the Linux Filesystem Hierarchy Standard.

Here, / represents two things:

  • The root directory at the top of the filesystem hierarchy.
  • It is also used as a directory separator to separate one directory from another. For example, the home directory is inside the / directory; hence, it is referred to as /home/. Similarly, if we have another directory, alice, above the /home directory, it is represented as /home/alice/.

Each directory is used for the standard purpose of organizing files of a particular type and purpose. Any directory can contain four types of content, asshown in the following table:

Content typeDescription
StaticThis type of content remains unmodified until explicitly edited
Dynamic or variableThistype ofcontent generally gets modifiedcontinuously
PersistentThis type of content retains changes made even after reboot, for example, configuration files
RuntimeThis type of content mostly resides in memory and its contents are cleared on reboot, for example, files used by processes of the system

The following table lists thelocationand purpose of important directories in CentOS:

LocationPurpose
/bootContains files required to start the boot process of CentOS 7, including the GRUB configuration file, the kernel image (vmlinuz), the RAM disk file (initramfs), and so on.
/devContains special device files used by the system to access hardware and software devices such as /dev/sda (for the hard disk drive), or /dev/pts1 (for representing a psuedo Terminal).
/etcContains configuration files for applications (resolv.confpasswd, and so on) installed on this particular system for system-wide changes.
/rootThe home directory of the root user, also known as superuser.
/homeContains home directories of normal users for storing their personal files.
/runContains runtime data, variables, process IDs, lock files, and so on for processes started since the last boot. The contents of this directory are regenerated upon restarting the system (in CentOS 6, its contents were stored in /var/run and /var/lock). One of the important subdirectories in this directory is as follows:/run/media: Used as a mount point for removable devices such as USB, CDs, DVDs, and so on
/varContains the variable data, specific to the system that persists across reboots. The content and size of these files change dynamically (for example log files, printer-spooled documents, website content, and FTP content) as the system is running.The /var directory can be put in its own filesystem so that the growth of files does not fatally affect the system.
/tmpContains temporary files; has write permissions enabled for all users on the system. The files that have not been accessed, modified, or changed in last 10 days are deleted automatically from this directory. Another temporary storage directory in our system is /var/tmp.
/usrContains application files, shared libraries, and documentation. The files in this directory are static, read-only, and shareable. It also has three important sub-directories, as follows:/usr/bin: Contains essential user commands (pslscp, and so on)/usr/sbin: Contains system administration commands (fsckshutdown, and so on)/usr/local: Contains data and program specific to the local machine/usr/include: Contains header files used to compile applications
/binA symbolic link to /usr/bin.
/sbinA symbolic link to /usr/sbin.
/libA symbolic link to /usr/lib; contains shared libraries used by applications stored in bin and /sbin.
/lib64A symbolic link to /usr/lib64 and contains the 64-bit shared libraries used by applications stored in /bin and /sbin.
/mntThis directory is used as temporary mount point for partitions and devices in the filesystem tree, such as for the mounting of NFS filesystems.
/proc Contains thevirtual filesystem(as in, it existsonlyin memory);also known as a psuedo-filesystemof the kernel. It contains dynamic runtime system information (for example, system memory, devices mounted, hardware configuration, and so on) and is considered the control and information center of the kernel. Some utilities directly call the files stored in this directory and display the information such as free memory using the /proc/meminfo file and arp table info using the /proc/net/arp file, and so on.