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
Leave a Reply