stat – display file or file system status

A UNIX Command stat -f /

$stat -f /
  File: "/"
    ID: bc427fdafb7b0541 Namelen: 255     Type: ext2/ext3
Block size: 4096       Fundamental block size: 4096
Blocks: Total: 18864769   Free: 16209639   Available: 15251363
Inodes: Total: 4792320    Free: 4684854

UNIX Explanation

Display file or file system status.

Related Source Code Exposition

static bool
do_statfs (char const *filename, bool terse, char const *format)

if (STATFS (filename, &statfsbuf) != 0)
error (0, errno, _("cannot read file system information for %s"),
quote (filename));
return false;

if (format == NULL)
format = (terse
? "%n %i %l %t %s %S %b %f %a %c %d\n"
: " File: \"%n\"\n"
" ID: %-8i Namelen: %-7l Type: %T\n"
"Block size: %-10s Fundamental block size: %S\n"
"Blocks: Total: %-10b Free: %-10f Available: %a\n"
"Inodes: Total: %-10c Free: %d\n");

print_it (format, filename, print_statfs, &statfsbuf);
return true;

Source Code Highlight

Stat the file system and print what we find.

Featured Image

Related Knowledge

Due to  shell aliases and built-in  `stat' command, using
an unadorned `stat' interactively  or in a script may get
you  different functionality  than  that described  here.
Invoke  it via  `env' (i.e.,  `env stat  ...')   to avoid
interference from the shell.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: