Using the Linux stat command to get information about a file.

Posted: February 1, 2016. At: 10:22 PM. This was 2 years ago. Post ID: 8660
Page permalink.
WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters. These cookies expire two weeks after they are set.

The Linux stat command allows information to be shown about a file on your file-system.

jason@darknet:~/Documents$ stat /bin/ls
  File: ‘/bin/ls’
  Size: 118280    	Blocks: 232        IO Block: 4096   regular file
Device: 801h/2049d	Inode: 10616940    Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2016-02-01 08:55:40.145487505 +1100
Modify: 2015-03-15 02:47:04.000000000 +1100
Change: 2016-01-19 13:22:58.462724858 +1100
 Birth: -

The example above shows the size of the file, the access, change and modification times and inode information.

The -t parameter shows the information in terse form.

jason@darknet:~/Documents$ stat -t /bin/ls
/bin/ls 118280 232 81ed 0 0 801 10616940 1 0 0 1454277340 1426348024 1453170178 0 4096

Use the -f parameter to get information about the filesystem instead of a file.

jason@darknet:~/Documents$ stat -f /
  File: "/"
    ID: 5f5a0e0ff79afa26 Namelen: 255     Type: ext2/ext3
Block size: 4096       Fundamental block size: 4096
Blocks: Total: 112936344  Free: 111033927  Available: 105291323
Inodes: Total: 28696576   Free: 28486575

This is a very useful Linux command, this will return useful filesystem information.

No comments have been made. Use this form to start the conversation :)

Leave a Reply