Where to start First steps track · 15 stages
Linux Labs

stat — file metadata

cheat sheet · GNU coreutils https://lab.dimsanych.ru/en/wiki/stat/

Cheat sheet

  • stat file everything
  • stat -c '%a %U:%G %n' file permissions-owner-name
  • stat -c '%Y' file mtime (unix)
  • ls -lc file ctime instead of mtime

Options

The -c flag sets a custom output format via placeholders (%a, %U, %s, and others) — without it, stat prints a fixed multi-line block that's inconvenient to parse in scripts. -L (--dereference) switches the output from the link itself to the file it points to; without it, checking permissions with stat on a symlink shows the link's permissions (usually 777), not the file's.

Loading…