At times, when you are doing any conversion of ascii to hex or to octal, we would like to view the hex contents or the hex dump of the file, be it ascii or binary. Let us see in this article the different ways to do it:
Let us contain a sample file, say file1, with the following content:
Any file present or created in Unix has 3 different time stamps associated with it . The 3 different timings are:
1. Last modified time - This refers to the timing when the file has been modified last. For a newly created file, this refers to the time when the file is created.
2. Last accessed time - This refers to the timing when the file has been accessed last. Access can be either when the file is read, or the file is written to or even if the file has been executed. The last accessed time gets updated when any of the above file operations is being done on a file.
3. Last changed time - This refers to the timing when the file status has been changed last. The change in file status could be due to any of the following reasons:
i) File ownership being changed.
ii) Group to which the file belongs to is changed.
iii) File permissions such as read, write or execute permissions has been applied or removed from the file.
iv) Advanced file permissions such as SUID, SGID or Sticky bit has been applied or removed on the file.
Everything is a file in Unix, we say. Users deal with files a lot, however, we usually can get most of our work done without needing to know about i-nodes, and their relation with files. However, if we know it, our clarity on looking at the file system will get better.
1. What is an Inode?
Inodes in Unix are data structures which contain all the properties of a file, metadata. The properties of the file include file size, file owner, the group to which the file belongs to, file access rights, hard link count, the location where the file contents are present and time stamps(last modified time, last accessed time, last changed time). In other words, the inode data structure contains all the information of the file except the file name and its contents.
Sometimes, we might have a requirement wherein we need to display the file contents with its line number. In this article, we will see the different ways in which we can achieve this line numbering of file.
Let us take a sample file, say file1, with the following contents: