Search a command in bash history
Follow @ggarronWhen you type long commands like this one to display only certain fields of the squid log file.
tail -f /var/log/squid/access.log | awk '{print $3,$4,$5,$7,$9}'
You do not want to type it again, every time you need it, so, you use history, you can find it by using.
history | grep tail
You will see an output like this
967 tail -f /var/log/squid/access.log | awk '{print $3,$4,$5,$7,$9}'
And then run it with:
!967
or you can run
!tail
And history will search for the command starting with tail, and will execute it.