Using bash history to get a previous command, copy it and then 'run' it but with the command commented

后端 未结 10 1134
伪装坚强ぢ
伪装坚强ぢ 2021-01-29 20:34

Just a question to improve my bash skills. I always do this:

$ history | grep some_long_command

...
...
123 some_long_command1.........
124 some_l         


        
10条回答
  •  旧时难觅i
    2021-01-29 21:21

    Put

    alias r='fc -s'

    in your .bashrc (home dir) then you can just type in

    r 
    

    at the command prompt and you will execute a copy of the last command (same params) that is in your history. just hit up arrow to see what you have executed if you feel the need.

提交回复
热议问题