manpagez: man pages & more
info coreutils
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

14.3 stat: Report file or file system status

stat displays information about the specified file(s). Synopsis:

stat [option]… [file]…

With no option, stat reports all information about the given files. But it also can be used to report the information of the file systems the given files are located on. If the files are links, stat can also give information about the files the links point to.


Change how stat treats symbolic links. With this option, stat acts on the file referenced by each symbolic link argument. Without it, stat acts on any symbolic link argument directly.


Report information about the file systems where the given files are located instead of information about the files themselves.


Use format rather than the default format. format is automatically newline-terminated, so running a command like the following with two or more file operands produces a line of output for each operand:

$ stat --format=%d:%i / /usr

Use format rather than the default format. Like ‘--format’, but interpret backslash escapes, and do not output a mandatory trailing newline. If you want a newline, include ‘\n’ in the format. Here's how you would use ‘--printf’ to print the device and inode numbers of ‘/’ and ‘/usr’:

$ stat --printf='%d:%i\n' / /usr

Print the information in terse form, suitable for parsing by other programs.

The valid format sequences for files are:

  • %a - Access rights in octal
  • %A - Access rights in human readable form
  • %b - Number of blocks allocated (see ‘%B’)
  • %B - The size in bytes of each block reported by ‘%b
  • %d - Device number in decimal
  • %D - Device number in hex
  • %f - Raw mode in hex
  • %F - File type
  • %g - Group ID of owner
  • %G - Group name of owner
  • %h - Number of hard links
  • %i - Inode number
  • %n - File name
  • %N - Quoted file name with dereference if symbolic link
  • %o - I/O block size
  • %s - Total size, in bytes
  • %t - Major device type in hex
  • %T - Minor device type in hex
  • %u - User ID of owner
  • %U - User name of owner
  • %x - Time of last access
  • %X - Time of last access as seconds since Epoch
  • %y - Time of last modification
  • %Y - Time of last modification as seconds since Epoch
  • %z - Time of last change
  • %Z - Time of last change as seconds since Epoch

The valid format sequences for file systems are:

  • %a - Free blocks available to non-super-user
  • %b - Total data blocks in file system
  • %c - Total file nodes in file system
  • %d - Free file nodes in file system
  • %f - Free blocks in file system
  • %i - File System ID in hex
  • %l - Maximum length of file names
  • %n - File name
  • %s - Block size (for faster transfers)
  • %S - Fundamental block size (for block counts)
  • %t - Type in hex
  • %T - Type in human readable form

Time stamps are listed according to the time zone rules specified by the TZ environment variable, or by the system default rules if TZ is not set. See (libc)TZ Variable section `Specifying the Time Zone with TZ' in The GNU C Library.

An exit status of zero indicates success, and a nonzero value indicates failure.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© 2000-2021
Individual documents may contain additional copyright information.