There may be situation that you want to make sure your file or directory cannot be DELETED by accident or intentionally.
In my case I like to protect this way my special directory containing my special and very important scripts. This is very easy to setup.
You need to obviously elevate your rights to do this task:
Youc an view attributes of the file using this command:
If you try to DELETE it, you will get error message
rm: cannot remove '/home/Scripts/Admin.sh': Operation not permitted
Now, it you want to revert and make the file again as before so you can delete, you just need to use this switch (-i) in the command
The same you can do for DIRECTORY and here is the command:
sudo chattr +i -RV /home/Scripts
sudo chattr -i -RV /home/Scripts