
Linux File System hierarchy & Commands
11 June 2023In this article we are discussing the basics of Linux file system hierarchy and how it works and basic commands of Linux which are important for beginners. This tutorial is recommended only for beginners who are new to Linux and curious to learn how the file system of Linux works.
Linux File System Hierarchy Structure
The FHS Stands for File System Hierarchy Structure. It describes the directory structure and directory contents of any Linux like Operating System Because it is an open source software. So, we are able to see the directory structure of Linux operating system. It is not possible in windows like operating system because they are closed source software.
/
It is the primary or main directory in the file system known as root directory. Represented by forward slash ( / ) and everything in your Linux system comes under this directory including all files and directories
/root
This directory is known as root user home directory. It stores configuration files for the root account. In Linux Unix the administrator is known as the root user.
/boot
It contains the essential files needed to boot any operating system such as boot loader files, kernel files and other boot configuration files.
/var
Var stands for variables. This directory includes the files that are constantly change in size during normal operations of the system such as logs, spool files and temporary e-mail files.
/etc
Etc stands for etcetera. It contains all the files that did not belong from anywhere else. It holds only configuration files not any binary files. This also contains startup and shutdown shell scripts used to start/stop individual programs.
/bin
Bin stands for binary. This directory contains user binaries, executable files and those type of Linux commands which are used in single user mode and common commands that are used by all the users, like ls, cat, cp, touch, cd, etc.
/media
Default mount point for removable storage media. Media directory accommodate temporary sub-directories on which removable media such as optical drives are automatically mounted. Examples : – /media/cdrom for CD-ROM, /media/cdrecorder for
CD writer
, /media/floppy for floppy drives.
/home
This directory is known as user’s home directory. You can simply understand that it is similar to settings and document folder in windows. It stores saved files, personal settings and folders that is specific to an individual user.
In home directory folders are in the form of /home/username where username belongs to the name of user which are currently login. It can be simply understood by taking an example, If APalgorithm is a login user then the home directory will be /home/APalgorithm.
/sbin
Sbin stands for System Binary. Sbin directory contains only essential commands that are preserved for the root user(superuser). These are special commands used for system administration tasks. Examples – fdisk, route, dump, reboot etc.
/usr
It is one of the most critical directories in the Linux system stands for Unix System Resources. System files contained in this directory are shareable among other users. System files contained in this directory are shareable among other users. It is similar to program files in windows.
/dev
The Dev directory contains information about all hardware devices. Dev stands for device. It includes information about terminal devices, USB, or any device attached to the system, while any virtual devices that are provided by the kernel. Examples of common files in the /dev directory – /dev/hda, /dev/tty0, /dev/sda, /dev/lp0 .
/opt
Opt stands for optional. It includes add-on(third party) applications from individual vendors. These types of applications are installed under either /opt/ or /opt/ sub-directory.
Linux Basic Commands
There are some basic commands of Linux which are very useful for beginners.
Ls Command
This command shows all the contents of your current working directory.
[root@pc~] # ls
PWD Command
This command will show the full path name of your current working directory from the root directory. PWD stands for print working directory. All given directories are separated by a forward slash(/), and the first directory represents the root directory and the last one is your current working directory.
[root@pc~] # pwd
Cd Command
The Cd command helps to navigate between directories in multiple ways and by using it you can easily navigate your directory with the help of terminals.
[root@pc~] # cd <Name of directory>
Cat Command
In the Linux operating system you can create files in various ways and one of them is by using the cat command. By the help of cat commands, you can simply create your file and open your file in reading mode.
- Creating a file using cat command
[root@pc~] # cat > <filename>
after that write content in your file and then press Ctrl+C
- To open the file in read mode or view the contents of file
[root@pc~] # cat <filename>
rm Command
The rm command helps to remove a file or directory in your Linux operating system.
[root@pc~] # rm <file or directory name>
Suggested Readings!
Thanks for reading. We hope that you like this post. If you have any queries related to this article, leave a comment down below!
Hey there, I’m Anshul Pal, a tech blogger and Computer Science graduate. I’m passionate about exploring tech-related topics and sharing the knowledge I’ve acquired. With two years of industry expertise in blogging and content writing, I’m also the co-founder of HVM Smart Solution. Thanks for reading my blog – Happy Learning!
Tnks so………………………