Updated: 3 November 2026 · Applies to: Linux, GNU coreutils stat

stat shows detailed status information for a file, directory or filesystem: size, permissions, ownership, inode number, and the access, modification and change times, in both human readable and machine readable form.

1. Check a single file's status

Give stat a file as its only argument for the default, human readable report:

stat /etc/hosts
  File: /etc/hosts
  Size: 198       	Blocks: 8          IO Block: 4096   regular file
Device: 0,24	Inode: 163747      Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2026-11-03 08:54:13.469545049 +0000
Modify: 2026-11-03 08:54:13.530545184 +0000
Change: 2026-11-03 08:54:13.530545184 +0000
 Birth: 2026-11-03 08:54:13.469545049 +0000

Access, Modify and Change are three different things: Access is when the file was last read, Modify is when its contents last changed, and Change is when its metadata, such as permissions or ownership, last changed. Birth is when the file was created, where the filesystem and kernel support it.

2. Check the filesystem instead of the file

Add -f to report on the filesystem the path lives on, instead of the file itself:

stat -f /etc/hosts
  File: "/etc/hosts"
    ID: 9d14e4261d6d0f60 Namelen: 255     Type: tmpfs
Block size: 4096       Fundamental block size: 4096
Blocks: Total: 195526     Free: 177313     Available: 177313
Inodes: Total: 819200     Free: 818352

Any path on that filesystem works the same way, including the root directory:

stat -f /

3. Follow symbolic links

By default stat reports on the symbolic link itself, not the file it points to. Add -L to follow the link and report on its target instead:

stat -L /etc/localtime

4. Print a custom format

The --printf option lets you print only the fields you want, using % codes, with no trailing newline unless you add \n yourself. For a file, common codes are %U for the owner's user name, %G for the owner's group name, and %z for the last status change time:

stat --printf="%U\n%G\n%z\n" /etc/hosts
root
root
2026-11-03 08:54:23.017566360 +0000

For a filesystem instead of a file, add -f alongside --printf and use the filesystem's own codes, such as %a for free blocks available to a normal user and %b for total data blocks:

stat -f --printf="%n\n%a\n%b\n" /
/
3707184
12577381

The same letter means something different depending on whether you add -f, so always check man stat for the list that applies to the mode you are using.

5. Print output in terse, one line form

For scripting, -t prints every field on one line, space separated, instead of the formatted report:

stat -t /etc/hosts
/etc/hosts 201 8 81a4 0 0 18 163794 1 0 0 1793696062 1793696063 1793696063 1793696062 4096

Your shell may provide its own, slightly different version of stat; check its documentation if any command here behaves differently. For the full list of accepted format codes, see the manual page:

man stat

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Managed dedicated servers

our engineers look after the server for you, from $135 a month.

Was this answer helpful?

Still stuck? Open a ticket