【linux学习笔记】查找命令小结
2013-09-16 11:45
423 查看
1.find
使用形式:
实例:find / -name 'hiphop*'
/:根目录
-name : 按名字查询
‘hiphop*’ 名字开头是‘hiphop’的文件
2.whereis
whereis
whereis命令只能用于程序名的搜索,而且只搜索二进制文件(参数-b)、man说明文件(参数-m)和源代码文件(参数-s)。如果省略参数,则返回所有信息。
whereis命令的使用实例:
whereis grep
3.grep
grep [OPTIONS] PATTERN [FILE...]
grep -rE 'test*' /etc/passwd
查找当前目录下所有包含something的文件:
4.查找和替换
The :substitute command searches for a text
pattern, and replaces it with a text string. There are many options, but these are what you probably want:
:%s/foo/bar/g
Find each occurrence of 'foo' (in all lines), and replace it with 'bar'.
:s/foo/bar/g
Find each occurrence of 'foo' (in the current line only), and replace it with 'bar'.
使用形式:
<span style="font-size:14px"> find <指定目录> <指定条件> <指定动作></span>
实例:find / -name 'hiphop*'
/:根目录
-name : 按名字查询
‘hiphop*’ 名字开头是‘hiphop’的文件
2.whereis
whereis
whereis命令只能用于程序名的搜索,而且只搜索二进制文件(参数-b)、man说明文件(参数-m)和源代码文件(参数-s)。如果省略参数,则返回所有信息。
whereis命令的使用实例:
whereis grep
3.grep
grep [OPTIONS] PATTERN [FILE...]
grep -rE 'test*' /etc/passwd
查找当前目录下所有包含something的文件:
grep -rE "*something*" ./
4.查找和替换
The :substitute command searches for a text
pattern, and replaces it with a text string. There are many options, but these are what you probably want:
:%s/foo/bar/g
Find each occurrence of 'foo' (in all lines), and replace it with 'bar'.
:s/foo/bar/g
Find each occurrence of 'foo' (in the current line only), and replace it with 'bar'.
相关文章推荐
- 每天一个 linux 命令(16):文件查找命令 which 命令---学习笔记
- linux文件查找命令(学习笔记)
- 每天一个 linux 命令(17):文件查找命令 whereis 命令---学习笔记
- 每天一个linux命令(22):文件查找命令 find 命令的参数详解---学习笔记
- 每天一个 linux 命令(18):文件查找命令 locate 命令---学习笔记
- 每天一个 linux 命令(19):文件查找命令 find 命令---学习笔记
- 学习笔记☞Linux常用命令【二】 (文件查找统计命令、打包解包命令、管理命令)
- 【linux学习笔记】vim命令小结
- linux命令学习笔记
- Linux学习笔记--free命令(查看内存信息的命令)
- Linux命令学习笔记(1)
- 菜鸟的Linux学习笔记之命令pwd
- Linux学习笔记9--touch命令使用
- Linux 学习笔记_3_Linux常用命令_1_文件管理命令
- Linux 学习笔记------目录处理命令:ls
- 菜鸟的Linux学习笔记之命令whereis
- Linux——帮助命令简单学习笔记
- Linux学习笔记---目录处理命令---删除文件或目录
- linux基础命令学习笔记
- linux命令学习笔记