Name

chattr [options] [+-=]attributes [files] — e2fsprogs

Synopsis

/usr/bin stdin stdout - file -- opt --help --version

If you grew up with other Unix systems, you might be surprised that Linux files can have additional attributes beyond their access permissions. If a file is on an ext2 or ext3 filesystem (the Fedora default), you can set these extended attributes with the chattr (change attribute) command and list them with lsattr.

As with chmod, attributes may be added (+) or removed (-) relatively, or set absolutely (=).

Attribute

Meaning

a

Append-only: appends are permitted to this file, but it cannot otherwise be edited. Root only.

A

Accesses not timestamped: accesses to this file don’t update its access timestamp (atime).

c

Compressed: data is transparently compressed on writes and uncompressed on reads.

d

Don’t dump: tell the dump program to ignore this file when making backups (see Backups and Remote Storage).

i

Immutable: file cannot be changed or deleted (root only).

j

Journaled data (ext3 filesystems only).

s

Secure deletion: if deleted, this file’s data is overwritten with zeroes.

S

Synchronous update: changes are written to disk immediately, as if you had typed sync after saving (see Disks and Filesystems).

u

Undeletable: file cannot be deleted (undeletable).

Useful options

-R

Recursively process directories.

Get Linux Pocket Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.