Use “stat” command to get information about file and filesystem

You know you have a “stat” command, that can be used either to check the status or properties of a single file or a entire filesystem.

It displays file or file system status such as:

File size
File type
Inode number
UID/GID
File access , modify and creation time etc.

For checking the status of a file, use

stat /your/filename

For checking the status of a entire filesystem, use

stat -f /home

Its a very handy tool for checking the information about last access dates etc. of a filesystem or a file.

Below is the screenshoot from my machine.

stat command to view file stats

Advertisements