chattr – change file attributes on a Linux file system

A UNIX Command

$lsattr test.ogg
------------------- test.ogg
$chattr +u test.ogg
$lsattr test.ogg
-u----------------- test.ogg
$chattr -u test.ogg
$lsattr test.ogg
------------------- test.ogg
$chattr =u test.ogg
$lsattr test.ogg
-u----------------- test.ogg
$chattr +i  test.ogg
chattr: Operation not permitted while setting flags on test.ogg
$sudo chattr +i  test.ogg
[sudo] password for jeffrin:
$lsattr test.ogg
-u--i-------------- test.ogg
$rm test.ogg
rm: remove write-protected regular file `test.ogg'? y
rm: cannot remove `test.ogg': Operation not permitted
$

UNIX Explanation

change file attributes on a Linux file system
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),  synchro nous updates  (S), and
top of directory hierarchy (T).


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s