-
-
Notifications
You must be signed in to change notification settings - Fork 1
Linux stat Guide
Mattscreative edited this page Dec 5, 2025
·
3 revisions
Complete beginner-friendly guide to stat on Linux, covering Arch Linux, CachyOS, and other distributions including file statistics, file information, and detailed file metadata.
Basic usage:
# File statistics
stat file.txt
# Shows detailed file informationDirectory info:
# Directory statistics
stat directory/
# Shows directory informationComplete info:
# Detailed information
stat file.txt
# Shows:
# - Size
# - Blocks
# - IO Block
# - Device
# - Inode
# - Links
# - Access
# - Modify
# - Change timesFollow symlinks:
# Follow symbolic links
stat -L symlink
# -L = follow (shows target file info)Format string:
# Custom format
stat -c "%n %s" file.txt
# -c = format
# %n = filename
# %s = sizeCommon formats:
# %n = filename
# %s = size
# %U = user name
# %G = group name
# %a = access rights (octal)
# %A = access rights (human)Multiple stats:
# Multiple files
stat file1.txt file2.txt
# Shows stats for each filePipe input:
# From input
ls *.txt | xargs stat
# Stats for all .txt filesCheck installation:
# stat is part of coreutils
# Usually pre-installed
# Check stat
which statThis guide covered stat usage, file statistics, and file information for Arch Linux, CachyOS, and other distributions.
- file Guide - File type detection
- ls Guide - List files
- File Operations - File management
-
stat Documentation:
man stat
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.