You have no excuses now, use this free credit to launch your projects now on Digital Ocean, you're free to spend it whenever you want within the following 60 days.
How to find a previously executed command in GNU Linux?
Sometimes we execute commands that solve a specific task on our system. We may have done a file lookup using regular expressions or perhaps we accessed a server via ssh and no longer remember the IP address. Re-creating the regular expression from scratch can be very time consuming and perhaps finding the IP again can also be more time consuming than if we could simply retrieve the command. We can find a previously executed command in GNU/Linux in a simple way, here is how.
One way to do this would be to perform a search for the part of the command that we remember in the command history. This can be done as follows:
history | grep "comando que buscamos"
The history command will show the list of commands used, the pipe character “|” will redirect the result to the grep command, which will search for the string you specify.
Command CTRL + R
There is an even simpler way to perform this search. This method is a keystroke combination that, despite its simplicity and ease of use, is not very popular, even among regular users of GNU/Linux environments.
First we will open a terminal, then we will press CTRL + R, this will modify the cursor as follows:
(reverse-i-search)`': history
As we press the keys, the commands that match that search will appear. If the command we are looking for is in the ~.history file, it will be displayed instantly.