首页 > 系统服务 > 详细

Linux Sysadmin Basics 04 -- Shell Features -- Pipes and Redirection

时间:2021-01-26 23:26:51      阅读:42      评论:0      收藏:0      [点我收藏+]
  • command1 | command2

    The output of one command is stored and then passed as the input for second command.

ps aux | less

  • three channels
    • STDIN —— 0
    • STDOUT —— 1
    • STDERR —— 2
  • output redirection
    • command > file : overwrite
    • command >> file : append
  • input redirection
    • command < file
  • error redirection
    • command 2> file
    • command 2>> file
echo "this should be in a file" 1> test.txt  # "1" can be ignored since it is the default
echo "this should be line 2" >> test.txt
mail -s "this is the subject" dave < message.txt
ls -alh thereisnosuchdir 2> err.txt

  • ps [options]

    report a snapshot of the current processes.

Linux Sysadmin Basics 04 -- Shell Features -- Pipes and Redirection

原文:https://www.cnblogs.com/goldenretriever/p/14332572.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!