The information we get from stat
Following is the information we get about the file when we run the stat command.
- File: The name of the provided file. If the provided file is a symlink, then the name will be different.
- Size: The size of a given file in Bytes.
- Blocks: Total number of allocated blocks to the file to store on the hard disk.
- IO Block: The size of every allocated block in bytes.
- File type: The file may be of the following types: Regular files, special files, directories, or symbolic links.
- Device: Device number in hexadecimal format.
- Inode: Inode number of the file.
- Links: Number of hard links of the file.
- Access: Access permissions in the numeric and symbolic methods.
- Context: The field stores SELinux security context.
- Access: The last time at which the file was accessed.
- Modify: The last time at which file was modified.
- Change: The last time the at which file’s attribute or content was changed.
- Birth: The time at which the file was created.
Now let’s see how can we display information about the file system.
Stat command in Linux with examples
The stat is a command which gives information about the file and filesystem. Stat command gives information such as the size of the file, access permissions and the user ID and group ID, birth time access time of the file. Stat command has another feature, by which it can also provide the file system information. This is the best tool to use when we want the information of any file.
Now let’ see one by one how can we use the stat command.