Stat

From LQWiki
Jump to: navigation, search

Stat displays the status of a file or the filesystem a file is on.

To obtain information about a file:

$ stat file

To obtain information about the filesystem file is on:

$ stat -f file

Use the -c option and various format sequences to obtain tailored output or the -t format for terse (and easily parsed) output. See the stat man page for full details.

Find out the size

You can use stat to find out a partition's size in blocks. To find out a partition's size in bytes, use fdisk as described here.

Provided by

Most (all?) Linux distributions incorporate this from the GNU Coreutils: man page

Related Commands

  • df - Report disk usage by filesystems.
  • du - Report disk usage by directory
  • sync - Update all cached disk blocks.
  • truncate - Change file length

This article is a stub and needs to be finished. Plunge forward and help it grow!