stat
displays the detailed status of file using inode data. Theses info include the date the file was last modified (like ls
), the time the file was last changed and the time that file was last accessed:
# stat /var/lib/dpkg/lock
File: `/var/lib/dpkg/lock'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 806h/2054d Inode: 57030 Links: 1
Access: (0640/-rw-r-----) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2011-08-13 12:17:00.000000000 +0200
Modify: 2012-03-08 16:03:20.000000000 +0100
Change: 2012-03-08 16:03:20.000000000 +0100
stat
can also be use to get information on a partition, using the -f
option:
# stat -f /dev/sda1
File: "/dev/sda1"
ID: 0 Namelen: 255 Type: tmpfs
Block size: 4096 Fundamental block size: 4096
Blocks: Total: 2560 Free: 2514 Available: 2514
Inodes: Total: 6181154 Free: 6180411
And don’t forget the most useful option for scripting --format
:
# stat --format "%A" /var/log/syslog
-rw-r-----