文件搜索命令locate,where,whereis,grep

1.locate 在文件资料库中查找文件

语法:locate 文件名

# -i 不区分大小写

locate -i filename

#更新文件资料库命令

update

2.which  用于查找命令所在目录及别名信息

语法:which 命令

#查找ls命令的文件信息

which ls

3.whereis 搜索命令所在目录及帮助文档路径

语法:whereis 命令命令

描述:搜索命令所在目录及帮助文档路径

whereis ls

4.grep 子文件中搜索字符串匹配的行并输出

grep  [指定字符串] [文件]

grep mysql  /xxs.log

-i 不区分大小写

-v 排除指定字符串

grep -iv [指定字符串] [文件]

配置以#号开头的行

grep -v ^# ~/ .bash_profile

猜你喜欢

转载自blog.csdn.net/PT1993/article/details/86238132