How can I recall the argument of the previous bash command?

前端 未结 7 1905
轮回少年
轮回少年 2020-12-04 04:33

Is there a way in Bash to recall the argument of the previous command?

I usually do vi file.c followed by gcc file.c.

Is there a w

相关标签:
7条回答
  • 2020-12-04 05:05

    If you know the number given in the history for a particular command, you can pretty much take any argument in that command using following terms.

    Use following to take the second argument from the third command in the history,

    !3:2

    Use following to take the third argument from the fifth last command in the history,

    !-5:3

    Using a minus sign, you ask it to traverse from the last command of the history.

    0 讨论(0)
提交回复
热议问题