Many times when we use the Linux command line, we need to find the used commands.
At this time, you usually like to use the up and down arrow keys or the history command to find the previously used command.
In this article, I’d like to share with you some quick search history command methods that you don’t know.
6 methods of executing historical commands
repeat the previous command
repeat the previous command headed by t
repeat the previous command with number in the history table
repeat the history table countdown number command
gets the last option in the previous command
- Ctrl + R
use Ctrl + R to enter the history search mode to query a past command in the history table. After finding the command to be repeated, press enter to execute the command
Like the above command, you can see that I typed !! . Actually, I repeated the last command ls.
As the above command, you can see that three rm commands have been typed, and input !r, which matches the last rm -rf t3.log command.
With the above command, history sees the number of history. Typed !6532 to execute ll with the number 6532.