How to get file and directory stat or information

The stat command is used to display detailed status of file, directory and file system in Linux.

Syntax: stat [options] FILE…


$ stat tmp/file1

File: tmp/file1
Size: 0 Blocks: 0  IO Block: 4096
Device: 12h/18d Inode: 3064192624  Links: 1
Access: (0660/-rw-rw—-)  Uid: (    0/ UNKNOWN)   Gid: ( 1028/ UNKNOWN)
Access: 2015-02-28 15:39:03.000000000
Modify: 2015-02-28 15:39:03.000000000
Change: 2015-02-28 15:39:03.000000000

So, without options/arguments you can have the following details:


Size in Bytes


Number of blocks used

IO Block

Size in bytes of every block


The identifier number of your storage device (harddrive, etc.)


The inode number that the file or directory is linked to

Access/Modify and change Times

Note that the timestamps also include which time zone that accesses or modifications took place in

The following are some of the flags and arguments that can be used for the stat command:




-f  –filesystem

display filesystem status instead of file status

-c   –format

use the specified FORMAT instead of the default

-L  –dereference

follow links

-Z   –context

print the security context


display the help and exit

You may want to see
How to use crontab in Linux

Cron is the system process that will automatically perform tasks for you according to a set schedule. The schedule is Read more

How to extract archive file in Linux

To extract archive file in Linux, you can use the tar command, used for extracting content from the archive files. "tar" Read more

How to Change permission of a file in Linux

chmod command is used to change the permission of a file in Linux. In Linux, there is a set of rules for Read more

How to create and remove the directory in Linux

There is a separate command to create and remove the directory in Linux. mkdir command is used to create a directory/folder Read more

Leave a Reply

Your email address will not be published. Required fields are marked *