Thursday, December 16, 2010

Checking the file attributes using lsattr

lsattr is a command line program for listing the attributes on a Linux second extended file system
It is also a command to display attributes of devices on an AIX operating system


lsattr COMMAND:
     lsattr command is used to list the attributes of the specified file or directory.

SYNTAX:
  The Syntax is
     lsattr [options]

OPTIONS:
     
-R Recursively list attributes of directories and their contents.
-a List all files in directories, including files that start with `.'.
-d List directories like other files, rather than listing their contents.


EXAMPLE:
    
  1. List attributes:
    lsattr 
    Lists the attributes of the current directory.
  2. Set the attribute:
    chattr +i test.txt 
    Set the attribute for 'test.txt' file.
  3. lsattr test.txt 
    Lists the attributes of the 'test.txt' file.
    ----i-------- ./test.txt

1 comment: