Inspect file attributes with lsattr
Check whether a file is immutable, append-only or undeletable before fighting with rm or chmod.
01Command
$ lsattr -a /etc/passwd02What it does
ext4 and friends store per-file attributes beyond the classic permission bits: i (immutable), a (append-only), A (no atime updates), j (forced journaling) and more. lsattr prints them as a flag string, which is the first thing to check when rm, chmod or a write fails with 'Operation not permitted' even as root. The counterpart chattr sets or clears the flags.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- lsattr(1) — Debian bookwormEvidence: SYNOPSIS lsattr [ -RVadlpv ] [ files... ] — list file attributes on a second extended filesystem, with -a for hidden files too.
- lsattr(1) — Arch Manual PagesEvidence: Same tool documented: lists the attributes of files on second extended filesystems, options -R -V -a -d.
Last verified: 2026-09-19 · Category: Files & Folders
06Related solutions
Find every occurrence of a pattern across all files in a tree, printed as file:line:number matches.
Unpack a gzipped tarball into the current directory while printing each file as it is extracted.
Show total, used, and available space plus usage percentage for every mounted filesystem in human-readable units.