lsattr 命令用于显示文件或目录的隐藏属性。
lsattr [-adlRvV][文件或目录...]-a 显示所有文件和目录,包括以"."为名称开头字符的额外内建,现行目录"."与上层目录".."。
-d 显示,目录名称,而非其内容。
-l 此参数目前没有任何作用。
-R 递归处理,将指定目录下的所有文件及子目录一并处理。
-v 显示文件或目录版本。
-V 显示版本信息。
(1)查看 source.txt 文件的属性
hxstrive@hxstrive:~$ lsattr source.txt
--------------e------- source.txt(2)查看所有文件的属性
lsattr: Operation not supported While reading flags on ./softsource.txt
--------------e------- ./.sudo_as_admin_successful
--------------e------- ./hardsource.txt
--------------e------- ./.bash_history
--------------e------- ./.motd_shown
--------------e------- ./.profile
--------------e------- ./source.txt
--------------e------- ./.bash_logout
lsattr: Operation not supported While reading flags on ./linkdir
--------------e------- ./.viminfo
--------------e------- ./tmpdir
--------------e------- ./.bashrc
--------------e------- ./tmp
--------------e------- ./..
--------------e------- ./.(3)查看目录的属性
hxstrive@hxstrive:~$ lsattr -d tmpdir/
--------------e------- tmpdir/更多关于命令详细参考手册,请使用 man 命令或者 --help 参数获取帮助信息