Linux Journal tip

Gerard J Snitselaar snits at snitselaar.org
Sat Sep 16 09:52:41 MST 2006


The tcsh manpage for FC5 says that the up and down arrows will step through
history. To search history for the current contents in the input buffer
you can use M-p (backwards), M-n (forwards). 

On  0, Carl Parrish <lists at pcl-consulting.com> wrote:
> Shawn Badger wrote:
> > I don't know how many of you receive this weekly newsletter from Linux
> > Journal. They have a section called The Brain Trust which had a tip that
> > I never heard of for searching the history in a Bash shell. Here is the
> > excerpt from the newsletter:
> >
> >  THE BRAIN TRUST: READERS SHARE THEIR EXPERTISE
> >
> >    This week we have a contribution from Jim C.:
> >
> >    "In the technical tips section of your newsletter on 9/5/06, you
> > referred to
> >    Bret's alias for searching bash history.  Why create an alias when
> > bash
> >    gives the user the 'reverse-i-search' and 'forward-i-search'
> > features?
> >
> >    At the command line, press Ctrl-R and see this appear on the screen:
> >
> >                 (reverse-i-search)`':
> >
> >    "Then press the characters of the search pattern desired, and bash
> > will display the nearest line from the current history position matching
> > the pattern.  Press Ctrl-R again to search the next nearest line; press
> > Ctrl-S to search forward.  Press enter to accept and immediately execute
> > the line displayed.  Press a left or right cursor key to accept and edit
> > the line. Press Ctrl-C to abandon the search.
> >
> >    "Much simpler than searching through a possibly long list from a grep
> >    search."
> >
> >    Do you have a useful technical tip to share with our community of
> > readers? Send your tips to jgray at ssc.com.  We'll send you a free t-shirt
> > for your efforts! Thanks!
> >
> > ---------------------------------------------------
> > PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
> > To subscribe, unsubscribe, or to change  you mail settings:
> > http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
> >
> >
> >   
> On FreeBSD tch shell had a *much* easier way to do this. I think it was
> just type part of the pattern then the Up arrow key and it searched back
> though your history the down arrow key searched forward. I stopped using
> tch (and freeBSD) awhile ago but recently tried it on a Linux box (RHEL
> 4) and it didn't work like I remembered.
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
> To subscribe, unsubscribe, or to change  you mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss


More information about the PLUG-discuss mailing list