Linux基础命令 -管道密切配合使用 tee

基础命令和管道密切配合使用  tee

 

 

基础命令:tee  

tee命令

功能:

把命令1STDOUT保存在文件名中,然后管道输入给命令2

补充说明:tee指令会从标准输入设备读取数据,将其内容输出到标准输出设备,同时保存成文件。

使用场景:

1.保存不同阶段的输出

2.复杂管道的故障排除

3.同时查看和记录输出

语法:

命令1 | tee文件名| 命令2

举例

1.举例:显示/boot目录下的文件列表,保存至/tmp/boot_out文件并在屏幕上显示。

ls  -1 /boot | tee  /tmp/boot_out  #如果不使用tee命令,标准输出至屏幕或重定向到文件 二者这能选其一
[root@wCentos7 ~]# ls  -1 /boot | tee  /tmp/boot_out
config-3.10.0-327.el7.x86_64
grub
grub2
initramfs-0-rescue-2d34ee936fa14412ad51a08dcb36643d.img
initramfs-3.10.0-327.el7.x86_64.img
initramfs-3.10.0-327.el7.x86_64kdump.img
initrd-plymouth.img
symvers-3.10.0-327.el7.x86_64.gz
System.map-3.10.0-327.el7.x86_64
vmlinuz-0-rescue-2d34ee936fa14412ad51a08dcb36643d
vmlinuz-3.10.0-327.el7.x86_64
[root@wCentos7 ~]#

原创文章,作者:linux_root,如若转载,请注明出处:http://www.178linux.com/27713

(0)
linux_rootlinux_root
上一篇 2016-08-03 14:33
下一篇 2016-08-03 14:59

相关推荐

  • 逻辑卷LVM练习题

     2、新建用户archlinux,要求其家目录为/users/archlinux ,而后su切换至archlinux用户,复制/etc/pam.d目录至自己 的家目录 [root@Cloud /]#useradd -d /users/archlinux archlinux #新建用户archlinux [archlinux@Cloud ~]# getent…

    Linux干货 2017-03-16
  • linux多网卡绑定

    为了增加网络牢固性,linux服务器通过多块网卡来实现网卡冗余或链路聚合、负载均衡的技术。网卡绑定mode共有七种(0~6) bond0、bond1、bond2、bond3、bond4、bond5、bond6常用的有三种mode=0:平衡负载模式,有自动备援,但需要”Switch”支援及设定。mode=1:自动备援模式,其中一条线若断线,其他线路将会自动备援…

    系统运维 2016-06-23
  • N26_第二周

    1、Linux上的文件管理类命令都有哪些,其常用的使用方法及其相关示例演示。 a 文件查看类  cat tac  head  tail more  less b 文件操作类  touch cp  mv  rm more命令:   &nbsp…

    2017-05-26
  • linux用户和组

    *** Linux用户和组: 1.用户:Username/UID     管理员:root, 0     系统用户:1-499(CENTOS6), 1-999(CENTOS7)     对守护进程获取资源进行权限分配  &nbsp…

    Linux干货 2016-08-04
  • 第二周作业

    一Linux上的文件管理类命令都有哪些,其常用的使用方法及其相关示例演示。 which命令:显示(shell)命令全部的路径 which [option] programmame […] –skip-alias:忽略别名   whereis命令:搜索二进制程序,源码,和帮助手册页的命令 whereis [option] na…

    Linux干货 2017-02-18