On the Linux command line, you often need to re-run previous commands. Let's look at how to quickly find and, if necessary, change a command that you have already executed before.
If this is a relatively recent command, you can simply press the Up key until the command appears. But if the command has been used for a long time, it is not always convenient.
There is another very simple and convenient way to search the command history — is to use keyboard shortcuts:
At the command prompt, simple press Ctrl+R.
You will be taken to the command history search mode. The prompt on the command line changes to:
Now you can start typing the name of the command you are looking for or any part of the command. That is, any sequence of characters from the command you want to find.
As you type the characters, the command history will be automatically searched according to the characters you enter, and if the corresponding command is found, it will be displayed on the command line.
The found command can be changed. To do this, press the Left or Right key to exit the search mode. The command appears on the command line and is editable.
To run the command, press Enter.
May the Force be with you,