Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Single easier command to search in bash history

Tags:

bash

On of the commands that I wrote the most on daily basis on my console is

# history | grep -i 'something'

That and ctr+r is probably what I use the most :).

I was thinking in have something like

# h something

Or even better, a live search like ctr+r but that shows all results at glance, not only one. I know i can cycle pressing ctrl+r again, but would be better if I could see what are all the elements that I"m cycling.

So this is 2 questions:

1) Do you know any program that provide a better interface for bash history in console?

2) What is the best way to accomplish my h something alias?

like image 389
Arnold Roa Avatar asked Oct 19 '22 23:10

Arnold Roa


1 Answers

Want a h command. Easy, add an alias in your .bashrc or .bash_profile or .bash_aliases (depending on your config).

alias h="history | grep -i"
like image 134
jherran Avatar answered Oct 22 '22 23:10

jherran