首页 > 其他 > 详细

bash: command types and commands

时间:2020-10-08 22:21:34      阅读:33      评论:0      收藏:0      [点我收藏+]
  • user
    • sudo <command> <arguments>: to work as root user
  • Terminal 
    • echo
    • printf
  • System and Env
    • pgrep <command name>: to get command process
      • /proc/$PID/environ: process <PID>‘s environment  

 

 

  • echo
    • echo -e "<string with regexp>"
    • $ echo -e "1\t2\t3"
      > 1    2    3
    • set color
    • \e[1,31m: to set color red
    • \e[0m: to reset color
    • for text: reset=0; black=30; red=31; green=32; yellow=33; blue=34; magenta=35; cyan=36; white=37
    • for background: reset=0; black=40; red=41; green=42; yellow=43; blue=44; magenta=45; cyan=46; white=47
    • $ echo -e "\e[1;31m test \e[0m"
      > test 

       

    • $ echo -e "\e[1;41m test \e[0m"
      > test
      

          

  • printf
    • %s, %c, %d, %f
    • -: left justifying
    • $ printf "%-5s %-5s %-5s\n" This is test
      > This  is    test
      
  • <process>
    • $ pgrep bash
      > 8111
      $ cat /proc/8111/environ
      > USER=aaaHOME=/u/aaaPATH=/bin......
      $cat /proc/8111/environ|tr ‘\0‘ ‘\n‘
      > USER=aaa
      HOME=/u/aaa
      PATH=/bin
      ....
      

       

    • sss
    • sss





bash: command types and commands

原文:https://www.cnblogs.com/cc-2020/p/13782478.html

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