How to Get File Information Using stat Command

The stat command in Linux system displays information about the specified file. Using the stat command, you can get file name, size, block, file type, file stored device number, inode, links, uid, gid, access, modify details, file change details, original file creation details and many more.

How to Use the stat Command:

Open the terminal application (ctrl+alt+t) and run below command. Here you can replace file.txt with your real file name.

stat file.txt

stat Command file

stat Command file location

To get details about several files at once, pass the filenames to stat on the command line like below.

stat file.txt file2.txt

stat Command two file

The -t option causes stat to provide a condensed summary of the file.

stat -t file.txt

stat Command t

The -f option tells stat to display the filesystem that the file resides on.

stat -f file.txt

stat Command f

For the complete details, run below commands.

stat --h
man stat
If you liked this article, please subscribe to our YouTube Channel. You can also stay connected with us on X (Twitter) and Facebook.



Also Read:  How To Find Filesystem Types in Ubuntu

Leave a Reply