HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

chattr — Change attributes of files or directories. More information: <https://manned.org/chattr>.

Submitted by: @import:tldr-pages··
0
Viewed 0 times
commandchattrfilesattributesclichangedirectoriesmore
linux

Problem

How to use the chattr command: Change attributes of files or directories. More information: <https://manned.org/chattr>.

Solution

chattr — Change attributes of files or directories. More information: <https://manned.org/chattr>.

Make a file or directory [i]mmutable to changes and deletion, even by superuser:
sudo chattr +i {{path/to/file_or_directory}}


Make a file or directory mutable:
sudo chattr -i {{path/to/file_or_directory}}


[R]ecursively make an entire directory and contents immutable:
sudo chattr -R +i {{path/to/directory}}


Mark a directory and its files to be interpreted in a case-insensitive manner (case-[F]olding):
chattr +F {{path/to/directory}}


Set a file to only allow [a]ppending:
sudo chattr +a {{path/to/file}}

Code Snippets

Make a file or directory [i]mmutable to changes and deletion, even by superuser

sudo chattr +i {{path/to/file_or_directory}}

Make a file or directory mutable

sudo chattr -i {{path/to/file_or_directory}}

[R]ecursively make an entire directory and contents immutable

sudo chattr -R +i {{path/to/directory}}

Mark a directory and its files to be interpreted in a case-insensitive manner (case-[F]olding)

chattr +F {{path/to/directory}}

Set a file to only allow [a]ppending

sudo chattr +a {{path/to/file}}

Context

tldr-pages: linux/chattr

Revisions (0)

No revisions yet.