Linux系统之find命令使用详解!
老男孩IT教育
行业新闻
2023年9月27日 14:21
find命令是一种通过条件匹配在指定目录下查找对应文件或者目录的工具,匹配的条件可以是文件名称、类型、大小、权限属性、时间戳等,今天老男孩教育小编带大家详细地了解一下find命令用法及参数,以下是详细的内容:
find命令是一种通过条件匹配在指定目录下查找对应文件或者目录的工具,匹配的条件可以是文件名称、类型、大小、权限属性、时间戳等,今天老男孩教育小编带大家详细地了解一下find命令用法及参数,以下是详细的内容:
1、查找当前路径名字叫“hello.txt”的文件:
用法:find ./ -name 文件名全程
例如:find ./ -name hello.txt
[root@test ~]# ls
anaconda-ks.cfg example.txt hello.txt
[root@test ~]# find ./ -name hello.txt
./hello.txt
批量查找名为hello的文件:
find ./ -name hel*
“*”为模糊匹配
[root@test ~]# find ./ -name hel*
./hello.txt
2、查找根目录名字叫“hello.txt”的文件:
用法:find / -name 文件名全程
例如:find / -name hello.txt
[root@test ~]# find / -name hello.txt
/root/hello.txt
3、查找删除名为“hello.txt”文件:
用法:find ./ -name 文件名|xargs rm
例如:find ./ -name hello.txt|xargs rm
老男孩教育Linux运维云计算课程汇集了虚拟化、云计算、安全攻防、Python开发、SRE等技术,课堂效率高、内容丰富全面,由浅入深,循序渐进,帮助学员稳扎稳打,夯实基础,在有限的时间内帮助学员高效提升,成为符合企业需求的技术型人才。
推荐阅读:
