bash history command linux code example

Example 1: show bash history

history # show all
history | tail -5 # show last 5
history | grep text # search for text

Example 2: 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 3: bash search history

sudo add-apt-repository ppa:ultradvorka/ppa && sudo apt-get update && sudo apt-get install hstr && hstr --show-configuration >> ~/.bashrc && . ~/.bashrc