From LQWiki
Jump to navigation Jump to search

chattr is a command used to set the file attributes.


The format of a symbolic mode is +-=[ASacDdIijsTtu].

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 ‘acdijsuADST’ select the new attributes for the files:

  • append only: File can be opened only in append mode
  • compressed: The file on the disk is automatically compressed. If read is performed from this file, uncompressed data is returned. If write is performed on this file, data is compressed before being written
  • no dump
  • immutable: The file cannot be modified,
  • data journalling
  • secure deletion
  • no tail-merging
  • undeletable: When such a file is deleted, its contents are saved. So it can be undeleted.
  • no Atime updates
  • synchronous Directory updates
  • Synchronous updates
  • Top of directory hierarchy

View the man page for more details.

See also