chattr Linux Commands
What is Linux chattr Command?
Explanation
chattr COMMAND:chattr command is used to change the file attributes. This is an admin command. Root user only can change the file attributes/Process.
SYNTAX :
chattr [options] filename
OPTIONS:
| +i |
Make the file as Read-Only. |
| -i |
Remove the Read-Only. |
| +a |
Can't open file for writing. |
| -a |
Open file for writing. |
| +S |
The changes in the file are written synchronously on the disk. |
EXAMPLE:
-
chattr +i test.txt
Here the 'test.txt' file has the write permission, to make it as Read-Only file use +i option.
chattr -i test.txt
The above command process is used to remove the Read-Only mark.