Navigating to the earliest/latest command in history when you're in the middle of your history

前端 未结 2 1601
别跟我提以往
别跟我提以往 2021-01-31 07:40

Say I am in a bash terminal and have a large history of commands. I pressed the up arrow a whole bunch of times and am in the \"middle\" of the history. I want to now navigate t

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-31 07:50

    Depending on how things are set up for your terminal, you can usually do a Ctrl+C to break you back to the beginning (no comment) and then go up once or twice to get to the recent command you want.

    Alternatively, using the history command will list all the recent commands used with index values associated with them. !# where # is the index number will rerun that command. There's a nice usefulness of the command history | grep [command] to try and find a specific command in your history.

提交回复
热议问题