美文网首页
linux 重定向与管道

linux 重定向与管道

作者: 小小机器人 | 来源:发表于2016-12-01 21:22 被阅读57次
一:重定向
1. 输入重定向(真不知道有什么卵用)
2. 输出重定向

‘>(覆盖)’ :把原本输出到屏幕的信息输出到其他地方

[xxjqr@localhost Desktop]$ cat test2.txt 
this is test2 file
[xxjqr@localhost Desktop]$ touch test.txt
[xxjqr@localhost Desktop]$ cat test2.txt > test.txt 
[xxjqr@localhost Desktop]$ cat test.txt 
this is test2 file
[xxjqr@localhost Desktop]$ 

'>>(追加)'

二:管道

管道其实就是一个连接符,把上一条命令的输出当作此条命令的输入

[xxjqr@localhost Desktop]$ cat test.txt 
This is first line
This is second line
This is third line
[xxjqr@localhost Desktop]$ cat test.txt | grep third
This is third line
[xxjqr@localhost Desktop]$ 

管道实例

[root@localhost Desktop]# cat /etc/passwd | grep root #查看是否存在指定账户
root:x:0:0:root:/root:/bin/bash
operator:x:11:0:operator:/root:/sbin/nologin
[root@localhost Desktop]# dmesg | grep eth0 #查看第一块网卡信息
e1000 0000:02:01.0: eth0: (PCI:66MHz:32-bit) 00:0c:29:a1:49:1e
e1000 0000:02:01.0: eth0: Intel(R) PRO/1000 Network Connection
ADDRCONF(NETDEV_UP): eth0: link is not ready
8021q: adding VLAN 0 to HW filter on device eth0
e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
eth0: no IPv6 routers present
e1000: eth0 NIC Link is Down
e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
[root@localhost Desktop]# rpm -qa | grep httpd #查看是否安装了apache软件
httpd-2.2.15-53.el6.centos.x86_64
httpd-tools-2.2.15-53.el6.centos.x86_64

相关文章

  • 管道命令

    参考linux shell 管道命令(pipe)使用及与shell重定向区别、管道命令 管道命令操作符是:”|”,...

  • 生信人的Linux14-24

    Liunx Day15:管道和重定向 管道和重定向:> < >> << Linux: >:覆盖输出 注意文件/t...

  • linux 重定向与管道

    一:重定向 1. 输入重定向(真不知道有什么卵用) 2. 输出重定向 ‘>(覆盖)’ :把原本输出到屏幕的信息输出...

  • Linux重定向与管道

    1.重定向概述 1.1什么是重定向 将原本要输出到屏幕的数据信息,重新定向到某个指定的文件中 1.2进程将从标准输...

  • Linux的管道命令

    Linux的管道命令 管道命令(Pipe) 双向重定向 字符转换命令:tr,col,join,paste,expand

  • Linux重定向day13

    1.重定向概述2.重定向的输出输入3.进程管道技术 一、重定向概述 什么是重定向:Linux重定向是指修改原来默认...

  • Linux系统介绍(四)IO重定向与管道

    IO重定向(IO redirection) Linux的有一个强大之处就是可以通过管道(Pipe)跟IO重定向将一...

  • Linux 重定向与管道符

    重定向与管道符 重定向 作用: 将命令的执行结果输出到指定的文件中,而不是直接显示在屏幕上 0 标准输入 键盘 s...

  • Lesson 007 —— Linux 文件及系统基础

    Lesson 007 —— Linux 文件及系统基础 文件操作 cat: 查看文件内容 > : 重定向(管道)符...

  • Windows PowerShell 学习笔记其二(变量与控制语

    重定向与管道 重定向 可以借助管道符和 Out-File 命令将某个命令的输出内容重定向至文本文件中。 如:Get...

网友评论

      本文标题:linux 重定向与管道

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