File Operations

stat

Display detailed file or filesystem status including inode information.

Synopsis

syntax
stat [OPTION]... FILE...

Examples

Show full metadata for a file
stat file.txt
Print only file size in bytes
stat -c '%s bytes' file.txt
Show permissions, owner, and group
stat -c '%a %U %G' /etc/passwd
Display filesystem info for root partition
stat -f /

Common options

FlagDescription
-cUse specified format string
-fDisplay filesystem status instead
-LFollow symbolic links
-tPrint in terse form

About stat

The `stat` command display detailed file or filesystem status including inode information. File operation commands are essential for navigating and managing the Linux filesystem.

They form the backbone of everyday system administration and development workflows. Mastering these commands enables you to efficiently create, move, copy, and organize files and directories from the terminal, which is often faster and more scriptable than graphical alternatives.

The command accepts 4 commonly used flags shown above, though the full set of options is available in the man page (`man stat`). The 4 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.

Related commands

More File Operations Commands

Other commands in the File Operations category

Related tools