一、说明
lsattr 命令用来查看文件的扩展属性
文件的扩展属性-单独写,这里先不介绍了。
[root@cenos79 test]# lsattr xargs.txt
-------------e-- xargs.txt
[root@cenos79 test]#
二、参数
1、-a 显示所有文件的扩展属性,包括隐藏文件的
[root@cenos79 test]# lsattr -a
-------------e-- ./.test
-------------e-- ./xargs test.txt
-------------e-- ./servicesmd5.txt
-------------e-- ./xargs.txt
-------------e-- ./..
-------------e-- ./sort.txt
-------------e-- ./.
-------------e-- ./rename
2、-d 只显示目录的扩展属性
[root@cenos79 test]# lsattr -d test/ ## -d 只查看该目录的扩展属性
-------------e-- test/
[root@cenos79 test]#
[root@cenos79 test]# lsattr test/ ## 如果不加 -d,后面接目录,查看该目录下所有的文件
-------------e-- test/new.txt
[root@cenos79 test]#
3、-R 递归的查看目录的扩展属性
[root@cenos79 ~]# lsattr -R test/ ## 列出该目录下所有的目录和文件的扩展属性
-------------e-- test/xargs test.txt
-------------e-- test/servicesmd5.txt
-------------e-- test/xargs.txt
-------------e-- test/sort.txt
-------------e-- test/rename
test/rename:
-------------e-- test/rename/b.png
-------------e-- test/rename/a.png
-------------e-- test/rename/a.txt
-------------e-- test/md5.txt
-------------e-- test/touch
test/touch:
-------------e-- test/touch/1.txt
-------------e-- test/touch/3.txt
-------------e-- test/touch/2.txt
-------------e-- test/touch/linux
-----a-------e-- test/zhu.txt
-------------e-- test/2021-06-24file.bak.txt
-------------e-- test/find
test/find:
-------------e-- test/find/girl4.png
-------------e-- test/find/girl3.png
-------------e-- test/find/girl1.png
-------------e-- test/find/girl2.png
-------------e-- test/find/girl5.png
-------------e-- test/test
test/test:
-------------e-- test/test/new.txt
-------------e-- test/more.txt