- 统计a.sh文件中hello出现的频率
Qufangdemac:test qfcomputer$ grep -o hello a.sh |wc -l
8
// -o代表的是只输出匹配的选项。
- 输出a.sh文件中hello出现的行数
Qufangdemac:test qfcomputer$ grep hello a.sh |wc -l
4
- 输出文档的前n行记录
Qufangdemac:test qfcomputer$ head -3 a.sh
this is a beautiful kit
hello world kitty hhhh
hello fuzi hello shenmu
- 输出文档后n行记录
Qufangdemac:test qfcomputer$ tail -3 a.sh
hello fuzi hello shenmu
hello inner hello xian
hello good morning hello hello china
- 查看端口占用情况
lsof -i:8080
网友评论