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.
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.
Syntax:
1 |
#mv dir1 Directory_1 |
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.
Syntax:
1 |
#mv –i /tmp/test.txt /tmp/Examine.txt |
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:
When the destination file permission is different than source file, mv –i command will display the confirmation in following way:
1 |
mv: try to overwrite ‘Examine.txt’, overriding mode 0644 (rw - r - - r--)? |
Syntax:
1 |
#mv * Linux_tuts/ |
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:
–S
or
–suffix option.
Syntax:
1 |
#mv –sufix=.doc test.txt Examine |
Backup for Examine file is taken and changed to Examine.doc
Syntax:
1 |
#mv –u d1/* d2 |
-u option will perform update only if the source is newer than destination file
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.
1 |
echo [option(s)] [string(s)] |
1 |
$ echo Hi, this is my session 2 |
1 |
$ x= 10$ echo value of x = $x |
1 |
$ echo “I \bLove \bLinux” |
1 |
$ echo “I \nLove \nLinux” |
1 |
$ echo * |
This command is used to copy one or more files from source path to destination path.
1 |
cp –[OPTION] [source] [destination] |
1 |
# cp originalfile newfile |
Explanation:
1 |
#cp originalfile /home/root |
Or
1 |
#cp originalfile /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:
1 |
# cp /home/root/folder1/contentfile/originalfile /home/root |
1 |
# cp originalfile /home/root/testFile |
1 |
# cp /home/root/testing* /home/ram |
1 |
# cp /home/root /home/ram |
1 |
# cp –v originalfile /home/root |
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.
1 |
# cp –backup=simple –v *.txt /home/root |
–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:
Few questions with their answers are present in assignment section for this 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.
1 |
ls [OPTION]... [FILE]... |
1 2 |
// Go to a folder and enter ls command like below $ ls |
1 |
$ ls -l |
1 |
$ ls -a |
1 |
$ ls -F |
1 |
$ ls -r |
1 |
$ ls -ltr |
1 |
$ ls -ls |
1 |
$ ls ~ |
1 |
$ ls ~Aman |
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.