linux 中查找隐藏文件及排除隐藏文件

 

001、查找当前目录下的隐藏文件

[root@PC1 test01]# ls
a.txt  dir1
[root@PC1 test01]# ls -a
.  ..  a.txt  dir1  .x.txt
[root@PC1 test01]# find ./ -maxdepth 1 -type f -name ".*"     ## 查找当前目录下的隐藏文件
./.x.txt

 

002、排除当前目录下的隐藏文件

[root@PC1 test01]# ls
a.txt  dir1
[root@PC1 test01]# ls -a
.  ..  a.txt  dir1  .x.txt
[root@PC1 test01]# find ./ -maxdepth 1 -type f -not -name ".*"      ## 排除当前目录下的隐藏文件
./a.txt

 。

 

posted @ 2023-07-31 17:39  小鲨鱼2018  阅读(962)  评论(0编辑  收藏  举报