O'Reilly logo

Linux in a Nutshell, Fourth Edition by Aaron Weber, Stephen Figgins, Ellen Siever

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

stat

Synopsis

                  stat [options] files
               

Print out the contents of an inode as they appear to the stat system call in a human-readable format. The error messages “Can’t stat file” and “Can’t lstat file” usually mean the file doesn’t exist. “Can’t readlink file” generally indicates that something is wrong with a symbolic link.

Options

-c format

Display the output as specified by format.

-f

Display information about the filesystem where the file is located, not about the file itself.

-l

For links, display information about the files found by following the links.

-s

For SE (Security Enhanced) Linux, show security information, if it’s available, in addition to stat’s normal output.

-t

Print the output tersely, in a form suitable for parsing by other programs.

-v

Print version information and exit.

Output

stat and stat -l display the following:

  • Device number

  • Inode number

  • Access rights

  • Number of hard links

  • Owner’s user ID and name, if available

  • Owner’s group ID and name, if available

  • Device type for inode device

  • Total size, in bytes

  • Number of blocks allocated

  • I/O blocksize

  • Last access time

  • Last modification time

  • Last change time

  • Security context for SE Linux

If -f is specified, stat displays the following information about the filesystem:

  • Filesystem type

  • Filesystem blocksize

  • Total blocks in the filesystem

  • Number of free blocks

  • Number of free blocks for nonroot users

  • Total number of inodes

  • Number of free inodes

  • Maximum filename length

Format

The printf(3) flag characters #, 0, -, +, and space can be used in format ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required