File System Hierarchy

Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

 In Linux everything is represented as a file including hardware program, the files are stored

in a directory, and every directory contains a file with the tree structure. That called File
System Hierarchy.

 Linux uses single rooted, inverted tree-like structure.

 Root Directory represent with / (forward slash)


It is top level directory in RHEL & all Linux.
 The base of Linux directory is the root. This is the starting point of FHS. Every
directory arises from the root directory. It is represented by a forward slash (/).

 If someone says to look into the slash directory then they referring to the root
directory
 It is home directory for the root user (superuser).
 Contains binary executable.
 Common Linux commands you need to use in single-user modes are located under
this directory.
 Commands used by all the users of the system are located here.
 For example:
ps, ls, ping, grep, cp.
 Just like /bin, /sbin also contains binary executables.
 But, the linux commands located under this directory are used typically by system
aministrator, for system maintenance purpose.
 For example: iptables, reboot, fdisk, ifconfig, swapon
 it contains hardware device files,
 Contains device files.
 These include terminal devices, usb, or any device attached to the system.
 For example: /dev/tty1, /dev/usbmon0
 The variable data files such as log files are located in the /var directory.
 File contents which tend to grow are located in this directory.
 This includes

◦ /var/log: System log files generated by OS and other applications.


◦ /var/lib: Contains database and packages files.
◦ /var/mail: Contains Emails.
◦ /var/tmp: Contains Temporary files needed for reboot.
 This directory is used to mount a file system temporarily
 The /media directory contains subdirectories where removable media devices
inserted into the computer are mounted.

 For example,

 when you insert a CD into your Linux system, a directory will automatically be
created inside the /media directory.
 You can access the contents of the CD inside this directory.
 The /usr directory contains applications and files used by users, as opposed to
applications and files used by the system
 It contains all configuration file of server

 The core configuration files are stored in /etc directory. It controls the behavior of
an operating system or application. This directory also contains startup and
shutdown program scripts that are used to start or stop individual programs.
 The /boot directory contains the files needed to boot the system

 – for example,
 the GRUB boot loader’s files and your Linux kernels are stored here
 The opt directory is used for installing application softwares from third-party
vendors that are not available in the Linux distribution. Usually, the software code is
stored in the opt directory and the binary code is linked to the bin directory so that
all users can run that software.

 For example,

 Google Earth application doesn’t come under Linux distribution and it is installed in
the /opt/google/earth directory.
 It contain secondary users home directory.

For example,
 if your user name is bob, you have a home folder located at /home/bob.

 This home folder contains the user’s data files and user-specific configuration files.
Each user only has write access to their own home folder
 Directory that contains temporary files created by system and users.

 Files under this directory are deleted when system is rebooted.


 Contains information about system process.

 This is a pseudo filesystem contains information about running process.

 For example:
/proc/{pid} directory contains information about the process with that particular pid.
 Bash (Bourne Again Shell) is the free version of the Bourne shell distributed
with Linux operating systems

 It provide command line interface in Linux operating system, it is upgraded version


of Bourne shell which is so popular in Unix OS.
Command is a simple software program or code that execute in backend when we run
any command on Bash (Terminal)
#pwd -it show present working directory
#ls -it show available files and directory list in present working directory.
#uname - it show name of kernel (OS)
#uname -r - it show version of kernel
#cd - it use for change directory
#clear - it use for clear screen
#whoami - it show currently login user name
#history - it show list of previously used commands
#date - it show time and date

You might also like