您的位置:首页 > 运维架构 > Linux

《Linux 系列》- 常用命令- grep和管道

2018-01-14 00:00 645 查看

为什么叫管道

它类似连通蓄水池和净水池的管道,功能有传输和连接

语法

语法: grep 需要搜索的字符串 搜索的文件
可以带正则表达式
搜索当前目录下的initial-setup-ks.cfg文件,所有带system关键字的行数据,返回字符串所在的行

[root@localhost ~]# grep system initial-setup-ks.cfg
@network-file-system-client

搜索当前目录下,带de的文件或文件夹

[root@localhost ~]# grep -i system initial-setup-ks.cfg
# X Window System configuration information
# System authorization information
# System services
# System language
# System timezone
# System bootloader configuration
@network-file-system-client

ll | grep de :首先执行 ll 命令,返回当前目录列表;把这个结果通过管道传给下一个命令,在列表中搜索带de的文件 或 文件夹
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Linux