Linux 的find命令怎么用

小老鼠
小老鼠 原创
2023-09-22 13:50:40 913浏览

Linux的find命令用法有:1、查找当前路径名字叫“hello.txt”的文件,用法为“find ./ -name 文件名全程”;2、查找根目录名字叫“hello.txt”的文件,用法为“find ./ -name 文件名|xargs rm";3、查找删除名为“hello.txt”文件,用法为“find ./ -name 文件名|xargs rm”。

详细的了解一下find命令用法及参数吧。

准备条件:

Centos7.9的操作系统的服务器一台;

Xshell终端已经链接了该服务器;

1、查找当前路径名字叫“hello.txt”的文件;

用法:find ./ -name 文件名全程

例如:find ./ -name hello.txt

QQ截图20230922111827.png

批量查找名为hello的文件:

find ./ -name hel*

“*”为模糊匹配

QQ截图20230922111908.png

2、查找根目录名字叫“hello.txt”的文件;

用法:find / -name 文件名全程

例如:find / -name hello.txt

QQ截图20230922111936.png

3、查找删除名为“hello.txt”文件;

用法:find ./ -name 文件名|xargs rm

例如:find ./ -name hello.txt|xargs rm

以上就是Linux 的find命令怎么用的详细内容,更多请关注php中文网其它相关文章!

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。