linux 中 find命令查找输出文件的绝对路径

发布时间 2023-09-15 12:01:49作者: 小鲨鱼2018

 

001、

[root@pc1 test1]# ls           ## 测试文件
a.txt  a.TXT  c.csv  c.tXt  d.txt  e.Txt  f.csv  k.map
[root@pc1 test1]# find ./ -name "*.txt"      ## 显示相对路径
./a.txt
./d.txt
[root@pc1 test1]# find $PWD -name "*.txt"    ## 输出绝对路径
/home/test1/a.txt
/home/test1/d.txt
[root@pc1 test1]# find $(pwd) -name "*.txt"   ## 输出绝对路径
/home/test1/a.txt
/home/test1/d.txt
[root@pc1 test1]# pwd
/home/test1
[root@pc1 test1]# find /home/test1 -name "*.txt"    ## 输出绝对路径
/home/test1/a.txt
/home/test1/d.txt

 

02、