lsattr查看文件的扩展属性

本文详细介绍了Linux系统中`lsattr`命令的用途,用于查看文件的扩展属性。通过参数`-a`可以显示所有文件,包括隐藏文件的扩展属性;参数`-d`仅显示目录属性;而`-R`则用于递归查看目录及其子目录下的文件扩展属性。示例展示了如何使用这些参数进行不同类型的文件和目录查询。
摘要由CSDN通过智能技术生成

一、说明

        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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值