Forrest logo
back to the lsattr tool

lsattr:tldr:2c49b

lsattr: Display the attributes of the files in the current directory.
$ lsattr
try on your machine

The lsattr command is used to list the attributes of files and directories in Linux. It stands for "list attributes".

When you execute lsattr along with a file or directory name, it will display the various attributes associated with that particular file or directory. These attributes provide information about how the file or directory can be modified or accessed.

Some common attributes that lsattr may display include:

  • i: Immutable attribute: Denotes that a file or directory cannot be modified, deleted, or renamed.
  • a: Append-only attribute: Allows new data to be added to a file, but prevents existing data from being modified or deleted.
  • d: No-dump attribute: Specifies that the file or directory should not be included in backups or system snapshots.
  • s: Secure-delete attribute: Ensures that, when a file is deleted, its data is securely overwritten to prevent recovery.

These are just a few examples, and there may be other attributes as well depending on your file system and configuration.

In addition to providing information about file and directory attributes, lsattr can also be used with the -R option to recursively display attributes for all files and directories within a specified directory and its subdirectories.

Note that the lsattr command requires root or superuser privileges to display attributes for certain files or directories.

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 lsattr tool