how to using Linux pipe command output another command's help content to a file

Linux tee > >>

gcc help

$ gcc --help
# ???
$ gcc --help | echo > gcc-help.md # output help to a file
$ gcc --help > gcc-help.md

> && >>

# > overwrite file
$ gcc --help > gcc-help.md # >> append data
$ gcc --help >> gcc-help.md

total 10 ways

         || visible in terminal ||   visible in file   || existing
Syntax || StdOut | StdErr || StdOut | StdErr || file
==========++==========+==========++==========+==========++===========
> || no | yes || yes | no || overwrite
>> || no | yes || yes | no || append
|| | || | ||
2> || yes | no || no | yes || overwrite
2>> || yes | no || no | yes || append
|| | || | ||
&> || no | no || yes | yes || overwrite
&>> || no | no || yes | yes || append
|| | || | ||
| tee || yes | yes || yes | no || overwrite
| tee -a || yes | yes || yes | no || append
|| | || | ||
n.e. (*) || yes | yes || no | yes || overwrite
n.e. (*) || yes | yes || no | yes || append
|| | || | ||
|& tee || yes | yes || yes | yes || overwrite
|& tee -a || yes | yes || yes | yes || append

tee

# output help to a file
$ gcc --help | tee gcc-help.txt # > overwrite file
$ gcc --help > gcc-help.txt
# >> append data
$ gcc --help >> gcc-help.txt

refs

https://askubuntu.com/questions/420981/how-do-i-save-terminal-output-to-a-file

https://en.wikipedia.org/wiki/Standard_streams#Standard_error_.28stderr.29

https://askubuntu.com/questions/38126/how-to-redirect-output-to-screen-as-well-as-a-file



xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


how to using Linux pipe command output another command's help content to a file的更多相关文章

  1. 【Linux】-NO.8.Linux.4.Command.1.001-【Common Command】-

    1.0.0 Summary Tittle:[Linux]-NO.8.Linux.4.Command.1.001-[Common Command]- Style:Linux Series:Command ...

  2. Linux pipe 源代码分析

    Linux pipe 源代码分析      管道pipe作为Unix中历史最悠久的IPC机制,存在各个版本号的Unix中,主要用于父子进程之间的通信(使用fork,从而子进程会获得父进程的打开文件表) ...

  3. centos 7.3 安装 mysqldb 报错 EnvironmentError: mysql_config not found ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

    ERROR: Command errored : command: /usr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] ...

  4. 解决xcode10打包报错:That command depends on command in Target ‘xxx’:scrpit phase"[CP] Copy Pods Resources"

    问题:使用xcode10打包报错,提示 error:Multiple commands produce ‘xxxx/xxx.app’ 1)Target ‘xx’ has create director ...

  5. Linux后台运行命令 nohup command > myout.file 2>&1

    Linux命令后台运行 转自北国的雨,谢谢:http://www.cnblogs.com/lwm-1988/archive/2011/08/20/2147299.html 有两种方式:1. comma ...

  6. 解决linux mysql命令 bash: mysql: command not found 的方法

    错误: root@DB-02 ~]# mysql -u root-bash: mysql: command not found 原因:这是由于系统默认会查找/usr/bin下的命令,如果这个命令不在这 ...

  7. Linux 中,基础命令 command not found...问题

    linux中出现基本命令找不到的问题,经过查找发现是/etc/profile文件出现了问题,解决方案如下: 问题详细: [root@master ~]# ll bash: ls: command no ...

  8. Linux下编译提示arm-none-linux-gnueabi-gcc: command not found

    自己的Linux系统中已经正确安装了交叉编译器arm-2009q3,路径设置正常. 但是在使用arm-none-linux-gnueabi-gcc编译时提示  arm-none-linux-gnuea ...

  9. linux下安装pm2,pm2: command not found

    1:安装pm2 操作描述: 你要在linux上安装pm2有很多方法,但我是用node的工具npm来完成安装的,所以在安装pm2之前需要先安装node.这里如果不会,就百度一个安装node,这个小事我就 ...

随机推荐

  1. bootstrap 轮播图带缩列图两端对齐,并自动换行然后左对齐!

    禁止自动轮播 data-interval="false" 完整代码如下: 1 <!DOCTYPE html> 2 <html> 3 4 <head&g ...

  2. 报错:java.lang.ClassNotFoundException: io.opentracing.util.GlobalTracer

    报错:java.lang.ClassNotFoundException: io.opentracing.util.GlobalTracer 近来在做一个在线教育的项目,课程信息放在数据库,而视频放在阿 ...

  3. hive报错:Failed with exception java.io.IOException: rename for src path:

    在hive中,会有这样一种情形: 1.创建一个分区外部表A(比如A表有5个字段),并且向A表里指定的分区(比如20160928这个分区)里插入数据 2.发现A表缺少一些字段,因为存在元数据不实时更新的 ...

  4. protoc-gen-validate (PGV)

    https://github.com/envoyproxy/protoc-gen-validate This project is currently in alpha. The API should ...

  5. celery 动态配置定时任务

    How to dynamically add or remove tasks to celerybeat? · Issue #3493 · celery/celery https://github.c ...

  6. 洛谷P4127

    Description 给出两个数 \(a\),\(b\) ,求出 \([a,b]\) 中各位数字之和能整除原数的数的个数 Solution 设 \(f[i][j][k][q]\) 表示 枚举到第 i ...

  7. LOJ1036

    AHOI 2008 聚会 Y 岛风景美丽宜人,气候温和,物产丰富.Y 岛上有 N 个城市,有 N-1 条城市间的道路连接着它们.每一条道路都连接某两个城市.幸运的是,小可可通过这些道路可以走遍 Y 岛 ...

  8. SpringCloud配置中心实战

    SpringCloud配置中心实战 1.统一配置中心(Config) 1.1 Spring项目配置加载顺序 1.2 配置规则详解 1.3 Git仓库配置 1.3.1 使用占位符 1.3.2 模式匹配 ...

  9. sql注入-原理&防御

    SQL注入是指web应用程序对用户输入数据的合法性没有判断或过滤不严,攻击者可以在web应用程序中事先定义好的查询语句的结尾上添加额外的SQL语句,在管理员不知情的情况下实现非法操作,以此来实现欺骗数 ...

  10. Spark Streaming状态管理函数updateStateByKey和mapWithState

    Spark Streaming状态管理函数updateStateByKey和mapWithState 一.状态管理函数 二.mapWithState 2.1关于mapWithState 2.2mapW ...