Skip to content

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.

Terminal window
stat [option] [file]
OptionDescription
-LFollow symbolic links
-cDisplay information in specified format
-fDisplay file system status instead
-tShow information in a terse format
-hPrint help message
-VPrint version information
ParameterDescription
fileSpecify the file to retrieve information
Terminal window
stat filename.txt

Displays detailed information about the file “filename.txt”.

Terminal window
stat -c %i filename.txt

Shows the inode number of the file “filename.txt”.

Terminal window
stat -c %a filename.txt

Prints the file permissions of “filename.txt” in octal format.

Terminal window
stat -c %w filename.txt

Retrieves the birth time of the file “filename.txt”.

Get Device ID and Inode in Human-Readable Format

Section titled “Get Device ID and Inode in Human-Readable Format”
Terminal window
stat -c "Device: %D Inode: %i" filename.txt

Displays the device ID and inode of “filename.txt” in a human-readable format.

{Questions}

  • Checking file or directory details
  • Retrieving information on file size
  • Determining file permissions
  • Viewing file timestamps
  • Checking information on file type