Tip to improve bash history

Tom Diehl tdiehl at rogueind.com
Mon Nov 17 23:48:32 UTC 2003

On Mon, 17 Nov 2003, Bret Hughes wrote:

> On Mon, 2003-11-17 at 16:30, Jimbo wrote:
> > Dont for get good old ctrl r
> > 
> I have read an reread the bash ma page trying to figure out how to use
> history searches but I guess I am too stupid to figure it out.  Maybe I
> will try the tip originally suggested.

If you use vi you can do "set -o vi" in your bashrc or whatever and that
will allow you to do things like "/ls <cr>" to find the last instance of ls
or things like "<esc> k" to see the last command or if you hit k numerous
times you get the previous command 1 line at a time. there are a bunch of
things that you can do. It acts like you are editing in vi. I also setup 
an alias like this: alias r="fc -e -" which allows me to do "r <cr>" to
repeat the last command. If you list the history and find the number in the
history that corresponds to a particular command you can also do something
like "r 235" and that will execute whatever command 235 was.

Hope this makes sense. If it does not but someone is interested ask
questions and I will try to answer them.

There is also emacs mode but I have never used it so one
of the emacs bigots on the list will have to comment on that. :-)



More information about the fedora-list mailing list