关于histroy的命令

  history bash 命令可以查看bash中输入的命令行的“历史”,即记录的意思

  我一般是这样使用的

  1.history   列出所以敲过的bash命令

  2.history  n   列出第几个敲过的命令

  3.!history    执行上一条执行的命令,其实用上下键切换回上一条命令回车,岂不是更方便,但是这条命令“!history”不会被写入“历史”中去

  那更多的history命令怎么来使用?还是帮助文档。


  man history 1

 An event designator is a reference to a command line entry in the history list.

       !      Start a history substitution, except when followed by a blank, newline, = or (.
       !n     Refer to command line n.
       !-n    Refer to the current command line minus n.
       !!     Refer to the previous command.  This is a synonym for `!-1'.
       !string
              Refer to the most recent command starting with string.
       !?string[?]
              Refer to the most recent command containing string.  The trailing ? may be omitted if  string  is  followed
              immediately by a newline.
       ^string1^string2^
              Quick   substitution.    Repeat   the   last  command,  replacing  string1  with  string2.   Equivalent  to
              ``!!:s/string1/string2/'' (see Modifiers below).
       !#     The entire command line typed so far.

 

那看看我们还能使用哪些命令

     4.  !n  执行历史中的第n条命令

其他的 在以后使用中在补充出来

除了这些,我们还可以在这个记录文件中查看历史

        vi ~.bash_history

可以查出历史中都输入了些什么命令行

   
ok,再来补充一下

   !-n   执行命令行历史后退n条的指令

   !!  等价于!-1

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值