The lsattr command is used to list the attributes of a file or directory. The below table describes some of the options of the lsattr command.

Option Used To
-R Recursively list attributes of directories and their contents
-a List all files in a directory
-d List directories like files, instead of their contents
-v List version number of files

Syntax

The syntax of the lsattr command is:

# lsattr [options] {file/ directory names}

Listing the attributes of a file.

lsattr command examples in Linux

lsattr Command Examples

1. To Recursively list attributes of directories and their contents:

2. To display the program version:

3. To list all files in directories, including files that start with “.”:

4. To list directories like other files, rather than listing their contents:

5. To List the files version/generation number: