Linux Tutorial


Linux Inode

Linux Inode

What is Inode?

Inode is abbreviated as Index Node. As we know in Linux, whatever is there is a file. So, in order to maintain a consistency by treating everything as a file (even the hardware devices). The monitor, hard disk, printer, mouse, keyboard or directories are also treated as files in Linux. The regular files contain data such as text files, music files (mp3, mp4, audio etc.), video (multimedia files ) etc. Keeping aside the regular data, there is some other data about these files such as their size, ownership, permissions, time stamp etc. This meta data about a file is managed with a data structure known as Inode.

Where is Inode stored?

In Linux, file is stored in two different parts of a disk – the data blocks and the Inodes. The data block contains contents of a file. All other information about the file is stored in Inode.

Example1 : Rename a directory dir1 to Directory_1 which is in your current path


Kindly note that Inode number of dir1 will be same as Directory_1. In order to view properties of a directory, use ls –d  command.

Example2 : Prompt for confirmation before overwriting Examine.txt in /tmp directory


This is used while we are taking a backup so that updated file is stored and kept for use.

The input required during the prompted confirmation is:

  • For yes : YES, Y, yes, y
  • For no : NO, N, no, n

When the destination file permission is different than source file, mv –i  command will display the confirmation in following way:

Example3 :Move multiple files in specific directory. ( Let’s say  we have Linux_Lect1, Linux_lect2 and we need to move it to Linux_tuts directory). We have both Linux_lect1, Linux_lect2 in my current path:


Example4 : Take a backup of Destination file “Examine“ before overwriting a file:

Using a mv command  with – – suffix  option we can take a backup of destination file before overwriting .  The destination file will be moved with the specified extension:



–suffix option.


Backup for Examine file is taken and changed to Examine.doc

Example5 : Suppose there are 10 files in directory d1 and we have copied any 8 files in directory d2. Now, we need to copy rest of the 2 files in directory d2.


-u option will perform update only if the source is newer than destination file


Linux ECHO Command

Linux ECHO Command


Usage of Linux ECHO Command:

This command is very important command widely used in bash and c shells. It is used to display a line of text/string on standard output or a console.


Example1 : Input a line “Hi, this is my session 2” and display on standard output.


Example2 : Declare a variable x and assign its value let’s say 30. Then, echo its value i.e. print value of x.


Example3 : Print statement “ I Love Linux” with no space using echo.

Explanation: Usage of \b as backslash interpreter.


Example4 : Print all words of a string keeping one word in each line. Lets take string as “I Love Linux”.

Explanation: \n is used as next line interpreter.


Example5 : Print all files and folder in current path using echo command (an alternative of ls command).




Linux CP Command

Linux CP Command


Usage of Linux cp Command:

This command is used to copy one or more files from source path to destination path.


Example1 : Make a copy of file into same directory.


  • Creates a copy of “originalfile” in present working directory. The copied file will be named as “newfile”.
  • Be very cautious while running the above command. If in case any file named as “newfile” exists in the same directory, it will be overwritten without confirmation prompt. This is the default behavior of cp command.
  • If you want to be prompted while overwriting a file, use interactive option (i). For example : # cp –i originalfile newfile. If “newfile “  exists , you will be prompted as:

    • cp : overwrite ‘newfile’?
  • If you type any of the combination (y,Y,yes,YES), the newfile will be overwritten and if you type any of the combination (n,N,no,NO), the newfile will not be overwritten, i.e. command will be nullified.


Example2 :Copy a file named as originalfile to another location say (/home/root). 



Both syntax are same. The forward slash-dot (/.) is implied in second command (the dot is very special in every Linux directory which means  “this directory”).

Suppose originalfile is at following path: /home/root/folder1/contentfile. Then, above syntax will be written as:

Example3 : Copy a file named as originalfile to another location say (/home/root) with a new name testFile.

Example4 : Copy all files starting with word “testing” from home directory of user “root” to home directory of user “govind”.

Note : Asterisk (*) is a wildcard or special character which expands to match other characters.

Example5 : Copy all files from the home directory of root to home directory of user ram.

Example6 : See what cp command is doing.

Example7 : Create backup date of each copied file.

If destination folder already have a file and we know that by using cp command, it will overwrite the same in destination directory. So, we use – backup option , cp command will make a backup of each existing file.

–backup=simple option will create a backup file which will be marked by a tilde sign(~) at the end of file. —backup option has following control options:

  • none, off: no backup will be created (even if –backup is given)
  • number, t : make numbered backup
  • existing, nil : numbered if numbered backup exist, simple otherwise.
  • simple, never: always make simple backups.

Few questions with their answers are present in assignment section for this command.



Linux LS Command

Linux LS Command


Usage of Linux LS Command:

This command is used to get list of files & folder at a particular path. Suppose there is a folder containing files and you want to know what all files are there in that folder we use this command. We use certain switches to get desired output.


Example1 : List all files in a folder.


Example2 : Show all the files of a directory, size, modified date and time, file and folder name and owner of file and its permission.


Example3 : View all hidden files in the folder.


Example4 : Know all files and directories in a current folder.


All files which are followed by / are directories and rest are files.

Example5 : List all files in reverse order.


Example6 : To print all files in reverse order.


Example7 : Sort the files by files size.


Example8 : List your home directory.

Example9 : List the home directory of user “Aman”.



Linux Tutorial


Linux Tutorial

In this free Linux Tutorial, we will cover most important topics of Linux in a short, crisp and concise manner. Tutorial sections will have Linux Commands with examples and brief of each command how it works. This tutorial will cover Linux Beginner Level to Linux Advanced Level. In case, you are good in Linux and want to assess your knowledge. You should solve the Linux Assignments present and take the Linux Quiz to see where you stand. 


To learn this tutorial, you don’t require any previous knowledge of this domain. Having knowledge in this domain is an added advantage.


Anyone who wants to gain extra knowledge of Linux Operating System and Linux Commands. This course can take up by students, geeks, Linux developers, testers, administrator. After completing this tutorial, you will find yourself ready to browse Linux Operating System, to answer Linux Interview Questions and to explore more around Linux.