Learn how to read the full metadata of files and filesystems with the GNU "stat" command and shape that output for scripts and audits. 06.05.2026 | reading time: 2 min What exactly is stored about a file beyond its name? Use "stat" to answer that fast; it reveals size, permissions, timestamps, inode and device info in one shot. A Hands-On Example Try this sequence to see raw and formatted output: ```bash $ touch report.txt $ stat report.txt File: 'report.txt' Size: 0 Blocks: 0 IO Block: 4096 regular empty file Device: 803h/2051d Inode: 123456 Links: 1 Access: (0644/-rw-r--r--) Uid: (1000/you) Gid: (1000/you) Access: 2026-05-06 10:00:00.000000000 +0000 Modify: 2026-05-06 10:00:00.000000000 +0000 Change: 2026-05-06 10:00:00.000000000 +0000 ``` And format a concise, script-friendly line with: ```bash $ stat -c '%A %U %G %s %y %n' report.txt -rw-r--r-- you you 0 2026-05-06 10:00:00.000000000 +0000 report.txt ``` Useful Flags and Formats Don't just run the default dump; shape output with `-c` or `--format` and `--printf` to extract exactly what a script needs, or use `-f` to inspect the underlying filesystem; common format sequences include %A (human perms), %a (octal perms), %U (owner name), %G (group name), %s (size), %i (inode), %y (modification time) and %n (file name). When stat Is Not Enough For ACLs use `getfacl`, for file type heuristics use `file`, for recursive searches use `find` with `-printf` or `-exec`, and for integrity checks pair `stat` with checksums like `sha256sum`; combine tools to build audits or quick health checks. Wrap-Up and Next Steps Mastering `stat` makes file audits and scripts more reliable; practice formatting output and chaining it with other utilities to automate checks, and consider deepening system knowledge with certifications such as CompTIA Linux+ or LPIC-1 using intensive exam preparation at bitsandbytes.academy. Join Bits & Bytes Academy First class LINUX exam preparation. filesystem utilities troubleshooting scripting