[NTLUG:Discuss] HOW? bash shell shortcut using history | grep

MadHat madhat at unspecific.com
Thu Jun 7 03:01:55 CDT 2001


At 11:12 PM 6/6/2001 -0500, you wrote:
>On Wed, Jun 06, 2001 at 11:00:57PM -0500, Richard Geoffrion wrote:
> >
> >  history | grep {command} ... then getting the number..then
> >  typing in the number and hitting some key to make the command
> >  pop onto the command line?
> >
> > What did he do?  What keystroke did he use?
>
>! immediately followed by the number.
>
>e.g.:
>
>   !435<enter>
>
>executes line 435 in history.
>
>!! repeats the most recent command line (like the up arrow).

also !<letter,or partial word> will run the last command that had that as 
the start, so if I do a
$ ssh 172.21.111.1
$ ping 172.21.111.1
$ nslookup 172.21.111.1
the type !s it will run the ssh command, !n will do the nslookup, !pi will 
run the ping.  It will do a simple match and the first entry it finds it 
matches (working backwards) it will run...

Hope that makes sense...



>Lance Simmons
>_______________________________________________
>http://www.ntlug.org/mailman/listinfo/discuss

--
MadHat at unspecific.com

"Focus on the packet.  It's better that way."
                                              -tb




More information about the Discuss mailing list