lsattr Command

The lsattr command is a Unix/Linux command used to list the attributes of files or directories on a file system that supports extended attributes. Extended attributes are additional metadata associated with a file or directory beyond the traditional metadata, like permissions, ownership, and modification time.

lsattr [options] [files/directories]
  • -a: Lists all files and directories, including those whose names start with a dot (hidden files).
  • -d: If the argument is a directory, list the attributes of the directory itself rather than its contents.
  • -R: Recursively lists the attributes of directories and their contents.

chattr command in Linux with examples

The chattr command in Linux is a file system command which is used for changing the attributes of a file in a directory. The primary use of this command is to make several files unable to be altered by users other than the superuser. As we know, Linux is a multi-user operating system. There is a chance that a user can delete a file that is of great concern to another user, says the administrator. To avoid such kinds of scenarios, Linux provides ‘chattr‘. In short, ‘chattr’ can make a file immutable, undeletable, only dependable and many more! 

Similar Reads

lsattr Command

The lsattr command is a Unix/Linux command used to list the attributes of files or directories on a file system that supports extended attributes. Extended attributes are additional metadata associated with a file or directory beyond the traditional metadata, like permissions, ownership, and modification time....

chattr Command

chattr [ -RVf ] [ -v version ] [ mode ] files......

lsattr Output

The output of the lsattr command typically displays a list of attributes for the specified files or directories. The attributes are represented by letters, and their meanings can vary depending on the file system and the attributes set. Here’s an example of what the output might look like:...

lsattr Options

The lsattr command has several options that allow you to customize its behavior when listing file and directory attributes. Here is a summary of the most commonly used options:...

Viewing Attributes of Files and Directories

Using lsattr to View Attributes: To view the attributes of files and directories, you use the lsattr command....

chattr command in Linux – FAQs

What does lsattr do in Linux?...