Linux find和grep的区别

1.find:查找文件或目录

语法: find 查找位置 文件名或目录名

如:在 /root/luojiahui目录下查找index.htm

find /root/luojiahui index.htm

在当前目录及其子目录中查找任何扩展名为"c"的文件(不加-print也会输出结果)

find . -name "*.c"

find bootable kernel  -name "*.c"

2.grep:在文件中查找字符串

语法:grep 字符串 文件名

如:grep success luojiahui.txt

在文件luojiahui.txt查找success

grep -r "待查字符串" *

grep -r  dump_info /home/zhenwx/kernel

你可能感兴趣的:(Linux find和grep的区别)