find:
查找在目录sthdir下的名称中含有st的文件和目录:
find sthdir -name “*st*” #双引号或单引号,一定要加上,不然是错误的命令;
-type f#查找文件
-type d #查找目录
-i #查找时不区分大小写
find sthdir -iname “*st*” -type f # 在sthdir目录下查找名字中含有st的文件
find sthdir -iname “*st*” -type d#在sthdir目录下查找名字中含有st的目录
find .sthdir
grep:
在 文件fileone中查找某行中含有namespace的所有行
grep namespace fileone;#-i 忽略大小写 -n列出行号
在某个目录sthdir中查找文件行中含有namespace的文件行号:
find sthdir -type f|xargs grep namespace -n