What is stat Linux command?
The Linux stat command is used to display detailed file or file system status information. This powerful command provides access to a wide range of data, including file type, permissions, size, access time, modification time, inode number, and much more.
stat Syntax:
stat Options:
Option | Description |
---|---|
-L | Follow symbolic links |
-c | Display information in specified format |
-f | Display file system status instead |
-t | Show information in a terse format |
-h | Print help message |
-V | Print version information |
Parameters:
Parameter | Description |
---|---|
file | Specify the file to retrieve information |
stat Command Usage Examples:
Check File Information
Displays detailed information about the file “filename.txt”.
Display File Inode Number
Shows the inode number of the file “filename.txt”.
View File Permissions in Octal Format
Prints the file permissions of “filename.txt” in octal format.
Show File Birth Time
Retrieves the birth time of the file “filename.txt”.
Get Device ID and Inode in Human-Readable Format
Displays the device ID and inode of “filename.txt” in a human-readable format.
{Questions}
Applications of the stat command
- Checking file or directory details
- Retrieving information on file size
- Determining file permissions
- Viewing file timestamps
- Checking information on file type