Linux File system & Basic commands

Linux File System Hierarchy Standard

File System Hierarchy Standard (FHS)


This directory is called as the ‘root’ directory. It is at the top of the file system structure. All other directories are placed under it.


The default home directory of the root. In Linux Unix the administrator is called as Root.


It contains the home directory of all users (similar to ‘documents and settings’ folder in Windows). When any user logs in the current working directory by default is the user’s home directory.


It contains the kernel, which is the core of the operating system. it also contains the files related for booting the OS such as the boot loader.


sbin stands for system binary.  It contains essential system commands which can only be used by the superuser (root). Example – fdisk, dump etc.


bin stands for binary. It contains essential commands which are used by all users. Example – ping, cat, chmodetc.


usr stands for UNIX system resources. It contains the programs and applications which are available for users (smililar to program files in Windows)


var stands for variable. It contains variable information, such as lags and print queues.


dev stands for device. It contains information about all hardware devices.


etc etc stands for et cetera. It contains all configuration files.


opt stands for optional. It generally contains the third party software. example – open office etc.


It is the default mount point for removable storage media such as cdrom/dvd and pendrives etc.

Linux Basic Commands

Print Working directory

[root@pc~] # pwd

List of files and directories

[root@pc~] # ls <options> <arguments>


-l  Long list including attributes

-a All files and directories including hidden

-d for a particular file or directory

-R recursive to see the tree structure

-i Inodes list

Creation of Flies

Users can create files in linux by using these commands:

  • cat command
  • touch command
  • vi editor
[root@pc~] # cat <options> <arguments>

// to create a file

[root@pc~] # cat > <filename>

// to view the contents of a file

[root@pc~] # cat <filename>

//  to append or add to an existing file

[root@pc~] # cat >> <filename>

// To combine the data of two or more files into a third file

[root@pc~] # cat <first file> <second file> >> <third file>

// to create a zero byte file

[root@pc~] # touch <filename>

// to create multiple zero byte files

[root@pc~] # touch <first file> <second file> <third file>

// to change the time stamp of a file or directory

[root@pc~] # touch <directory or filename>

// to create file using by Vi editor

[root@pc~] # vi <filename>

Creating Directories

// to create a directory

[root@pc~] # mkdir <directory name>

// to create multiple directories

[root@pc~] # mkdir <first dir> <second dir> <third dir>

// to create nested directories

[root@pc~] # mkdir -p <first dir>/<second dir>/<third dir>

Navigation of directories

// to change the directory

[root@pc~] # cd <path of the directory>

// to change directory one level back

[root@pc~] # cd ..

// to change directory two levels back

[root@pc~] # cd ../..

// to change to the users home directory

[root@pc~] # cd

Help and Command records

// to view the manual page of a command

[root@pc~] # man <command>

// to view the commands history

[root@pc~] # history


// to copy a file or directory

[root@pc~] # cp <options> <source file> <destination>


-r Recursive (to copy the directory along with its contents)

-v verbose

-p copy with permissions

Moving and renaming

// to move a file or directory to a different location

[root@pc~] # mv <source file or directory> <destination>

// Rename a file or directory

[root@pc~] # mv <old name> <new name>


// to remove or delete an empty directory

[root@pc~] # rmdir <dir name>

// to remove or delete a file or directory

[root@pc~] # rm <options> <file or dir name>


-r Recursive (Directory along with contents)

-f Forcefully

Some Other Commands

// to check date and time

[root@pc~] # date

// to see the calendar

[root@pc~] # cal | less  or # cal | more

File Viewing commands

// to view the contents of a file screen-wise

[root@pc~] # less <filename>

// to view the top lines of a file

[root@pc~] # head <filename>
[root@pc~] # head -5 <filename>

//to view the bottom lines of a file

[root@pc~] # tail <filename>

[root@pc~] # tail -3 <filename>

File viewing Commands

//to find the location of file or directory

[root@pc~] # find / -iname <file/dir name>

// to count the words, lines and characters of file

[root@pc~] # wc install.log

You may like also:

This article originally published at

Thanks for reading. If you like this post probably you might like my next ones, so please support me by subscribing my blog.

Rohit Kumar Singh

Technical writer, enthusiastic to learn new technologies and exploring the things.

Leave a Reply

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