terminal search command history code example Example 1: find old command terminal history | grep "foo*" Example 2: search terminal history ctrl + R (for linux and osx)