![Forrest logo](/images/logo.png)
lsattr:tldr:2c49b
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.