chattr — stdin stdout - file -- opt --help --version
chattr [options
] [+ − =]attributes
[files
]
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 “ext” filesystem (ext2, ext3, etc.),
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 (=).
For example, to keep a file compressed and nondumpable, run:
$ chattr +cd myfile
Attribute |
Meaning |
---|---|
|
Append-only: appends are permitted to this file, but it cannot otherwise be edited. Root only. |
|
Accesses not timestamped: accesses to this file don’t update its access timestamp (atime). |
|
Compressed: data is transparently compressed on writes and uncompressed on reads. |
|
Don’t dump: tell the
|
|
Immutable: file cannot be changed or deleted (root only). |
|
Journaled data (ext3 filesystems only). |
|
Secure deletion: if deleted, this file’s data is overwritten with zeroes. |
|
Synchronous update:
changes are written to disk immediately, as if you had typed
|
|
Undeletable: file cannot be deleted. |
There are a few other attributes too, some of them obscure or experimental. See the manpage for details.
18.221.222.47