美文网首页
Linux命令: |

Linux命令: |

作者: 闲云野鹤_23dd | 来源:发表于2020-11-26 20:19 被阅读0次

|

| 这个不是字母L,在Linux中叫做管道符,按住shift+\键 就出来了。管道符就是把上一条命令的输出,作为下一条命令参数。

管道符 通常配合 grep 命令使用,用来过滤一些内容

<mark style="box-sizing: border-box; background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);">工作应用场景,管道常用于字符串处理文件处理等命令拼接</mark>

实战

查看/root目录下名称包含Test的文件或目录的详细信息

ll /root | grep test

image.png

查看/root/vimTest/base.yml 文件前10行中包含mysql的行

head /root/vimTest/base.yml | grep mysql

image.png

查看/root/vimTest/base.yml 文件末尾20行中包含mysql的行

tail -n20 /root/vimTest/base.yml | grep mysql

image.png

相关文章

网友评论

      本文标题:Linux命令: |

      本文链接:https://www.haomeiwen.com/subject/nmncvktx.html