find old command terminal code example

Example 1: ubuntu search for command used

> grep "the_search" ~/.bash_history

--Don't forget the -i flag if you need case insensitive search.

Example 2: find old command terminal

history | grep "foo*"

Example 3: histroy of commands

Highly recommended command to use in terminal for reviewing commands and
reuse some of them. Just execute in terminal:

history

Also recommended to use together with grep for filtering a specific used command

history | grep "foo*"

Example 4: linux history command

Just check the enumeration of your commands history and then delete them:
history -d 7 #Deletes seventh command in your history list