The stat command is used on a Linux/Unix system to display detailed information about files and file systems. It is usually used for obtaining labels for temporary files.

The Linux ls command usually gives basic information about the file, while the stat command gives additional information about the file extracted from the input code.

In this tutorial we go deeper into the statistics team and its possibilities.



1) Check the status of folder.

Run the file to display the file status, e.g. B. Size, code references, and timestamp :


Prints the following information :

A file is a filename.

The size is the size of a normal file in bytes.

Blocks – The number of selected blocks assigned to a file.

The IO block is the size of each block in bytes.

File type – Defines the type of file (whether it is an ordinary file, a symbolic link, etc.).

A device is a device number in decimal or hexadecimal format.

Input – Displays the input number.

Links – specifies the number of hard links.

Access – displays the access rights to a file in numeric or symbolic form.

The Uid is a means of identification and the name of the owner.

Guide – Group identification and name of the owner.

Context – describes the security context of SELinux

Access – indicates the date when the file was last opened.

Modify – indicates the date of the last modification of the content of the file

The change is the last time the metadata in the file was changed.

2) Check the status of the file system

To print the status of the file system where the file is located, use the -f or –file system option instead of information about a normal file.

$-Statistics -f output.txt

Prints the following information :

File – Describes the name of the file.

ID – specifies the system identification in the hexadecimal system.

Naming – indicates the maximum length of the file.

The base block size is the size of each block in the file system.


Total – shows the total number of blocks in the file system.

Free – The number of free blocks remaining in the file system.

Available – Number of free blocks available for non-root users.


This is the total number of codes in the system.

Free is the number of freely available codes.

4) Follow the links Sim

By default, the stat command does not follow symbolic links. If you output it via a SIM link, the output contains information about the SIM link and not about the file it refers to.

statistics $ /usr/share/zoneinfo/ America/Cayman

To click on a SIM link and print information about the file to which it refers, use the -L option as shown in the figure :

Statistics $ -L /usr/share/zone info/America/Cayman

5) User output

Instead of printing in a custom standard format, you can configure the output of the stat command with the –printf or -format options.

With –printf you must use n to print two or more file operations on a new line. For example, to print the device and the code number:

stat –printf=’%d:%in’ /usr /etcOutput

With the format -, for example, it prints a new standard line:

stat format=%d:%i /usr /etcOutput

To print the file name and the time when the data was last changed, enter the following

stat –printf= Name: %ppThe time of the last modification of the data: %yn /usrOutput
Name: /usr
The time of last data amendment : 2020-09-28 21:47:27.451120000 +0000

To print the owner’s username, file type and total size in bytes, enter the :

stat format=%U,%F,%s /usrOutput
stat format=%U,%F,%s /usr

6) Presentation of the short form

To print the information in compressed form, use the -t option, which is useful when analyzing with other tools.


Status is a useful command to check the timestamp of files, such as the time the file was changed or the time the file was opened. In this tutorial we have taken a closer look at the stat command under Linux and highlighted some application examples.

stat command mac,stat command in unix geeksforgeeks,linux stat modify vs change,stat linux terminal,stat printf s,linux stat tutorial,stat command in windows,linux stat command permissions,linux stat access modify change,stat date format,statistics in unix,linux stat example c,stat example bash,linux command for status,mac stat command,linux system call tutorial,fstat in unix,stat command terminal,unix set file mtime,stat command in aix,stat command in linux with examples,stat command in linux geeksforgeeks,linux stat directory,linux stat command man page,linux stat command date format

You May Also Like

How to Enter Recovery Mode on Posh Kick Pro LTE L520 Phone

Here are full instructions on how to activate recovery mode with your…

Best Laptops for Computer Science Students? Buyer Guide (2020 edition)

You can come from any field, without a decent (or rather good)…

Best Prime Day Fitness Tracker Deals – Fitbit Deals, Garmin Deals, Moov Deals, and More!

Last updated on the 13th. October 2020 The party is back in…

5 of the Best Document Scanner Apps for iOS

Paper soon belongs to the past. However, there are situations in which…