The lsattr command in Linux is used to display the file attributes on a file or directory. It shows the attributes that affect how the file can be manipulated by the system and users.
Common Attributes Displayed by lsattr:
a: Append only - the file can only be opened in append mode for writing.c: Compressed - the file is compressed on disk.d: No dump - the file will not be included in backup operations using thedumpcommand.i: Immutable - the file cannot be modified, deleted, or renamed.s: Secure deletion - the file is securely deleted when removed.t: No tail merging - the file will not have its tail merged with other files.u: Undeletable - the file can be deleted but can be recovered.
Usage:
To use the lsattr command, simply type:
lsattr filename
Example:
lsattr myfile.txt
This will display the attributes of myfile.txt. If you want to see the attributes of all files in a directory, you can run:
lsattr *
This command is particularly useful for system administrators and users who need to manage file permissions and behaviors at a deeper level.
