lsattr:查看文件的扩展属性

xiaohai 2021-05-05 16:56:57 2449人围观 标签: Linux 
简介lsattr命令用于查看文件的扩展属性
说明

  lsattr命令用于查看文件的扩展属性

格式

  lsattr [option] [file…]

常用参数说明

-R:递归查看目录的扩展属性
-a:显示所有文件的扩展属性,包括隐藏文件
-d:显示目录的扩展属性

示例
[root@localhost test]# lsattr test2.txt #单个文件
---------------- test2.txt
[root@localhost test]# lsattr test2.txt test3.txt  #多个文件用空格隔开
---------------- test2.txt
---------------- test3.txt
[root@localhost test]# lsattr dir01 #目录需要使用-d参数,否则会提示下面的信息
lsattr: 不支持的操作 While reading flags on dir01/test2.txt 
---------------- dir01/abc
---------------- dir01/def

[root@localhost test]# lsattr -d dir01 #-d参数的使用
---------------- dir01

[root@localhost test]# lsattr -a dir01 #-a参数的使用
---------------- dir01/.
---------------- dir01/..
lsattr: 不支持的操作 While reading flags on dir01/test2.txt
---------------- dir01/abc
---------------- dir01/def

[root@localhost test]# lsattr -R dir01 #-R参数的使用
lsattr: 不支持的操作 While reading flags on dir01/test2.txt
---------------- dir01/abc

dir01/abc:

---------------- dir01/def

dir01/def: