command line history code example

Example 1: history command linux

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 2: command line history search

Ctrl+R
 - Start typing a command and the most recent matching command will appear
 - Press Ctrl+R again to cycle through results
 - Press Enter or Tab to select the result