Forrest logo
back to the chattr tool

chattr:tldr:6cdf6

chattr: Recursively make an entire directory and contents immutable.
$ chattr -R +i ${path-to-directory}
try on your machine

The command "chattr -R +i ${path-to-directory}" is a Linux command used to change the attributes of a directory and its contents.

  • "chattr" is a command used to change file attributes in Linux.
  • "-R" is an option to perform the operation recursively, meaning it will affect the directory and all its subdirectories and files.
  • "+i" is an attribute that can be set for files or directories, which makes them immutable. Once the immutable attribute is set, the file or directory cannot be modified, deleted, renamed, or linked.
  • "${path-to-directory}" is the path to the directory where you want to set the immutable attribute.

So, this command sets the immutable attribute (+i) recursively (-R) for the specified directory and all its contents. This ensures that none of the files or directories within the specified directory can be modified or deleted until the immutable attribute is removed.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the chattr tool