CHATTR(1)
CHATTR(1)
NAME
chattr − change file attributes on a Linux file system
SYNOPSIS
chattr [ −RVf ] [ −v version ] [ mode ] files...
DESCRIPTION
chattr changes the file attributes on a Linux file system.
The format of a symbolic mode is +-=[acdeijstuADST].
The operator ‘+’ causes the selected attributes to be added to the existing attributes of the files; ‘-’ causes
them to be removed; and ‘=’ causes them to be the only attributes that the files have.
The letters ‘acdeijstuADST’ select the new attributes for the files: append only (a), compressed (c), no
dump (d), extent format (e), immutable (i), data journalling (j), secure deletion (s), no tail-merging (t),
undeletable (u), no atime updates (A), synchronous directory updates (D), synchronous updates (S), and top
of directory hierarchy (T).
The following attributes are read-only, and may be listed by lsattr(1) but not modified by chattr: huge file
(h), compression error (E), indexed directory (I), compression raw access (X), and compressed dirty file
(Z).
OPTIONS
−R
Recursively change attributes of directories and their contents.
−V
Be verbose with chattr’s output and print the program version.
−f
Suppress most error messages.
−v version
Set the file’s version/generation number.
ATTRIBUTES
When a file with the ’A’ attribute set is accessed, its atime record is not modified. This avoids a certain
amount of disk I/O for laptop systems.
A file with the ‘a’ attribute set can only be open in append mode for writing. Only the superuser or a
process possessing the CAP_LINUX_IMMUTABLE capability can set or clear this attribute.
A file with the ‘c’ attribute set is automatically compressed on the disk by the kernel. A read from this file
returns uncompressed data. A write to this file compresses data before storing them on the disk. Note:
please make sure to read the bugs and limitations section at the end of this document.
When a directory with the ‘D’ attribute set is modified, the changes are written synchronously on the disk;
this is equivalent to the ‘dirsync