[colug-432] Search Command History

Steve VanSlyck s.vanslyck723 at gmail.com
Tue Feb 11 06:41:41 EST 2014


It's easier to press one arrow key a few times than to type out a command phrase.

Jim Wildman <jim at rossberry.com> wrote:
>
>With bash
>!?phrase
>will search for and execute that last command containg phrase
>
>history | grep apt (as others said) will find the command, with the
>command number in front
>
>!number will execute that command
>!number:s/oldphrase/newphrase/  will edit and then execute the command
>
>you can do similar things with the 'fc' command which will open your
>default editor with the given command. The command executes when you
>exit the editor.
>
>   983  exit
>   984  ls
>   985  ls
>   986  cd rossdev
>   987  ls
>   988  cat rbhosts.txt
>   989  svn up
>   990  exit
>   991  scdr
>   992  pine
>   993  screen
>   994  scdr
>   995  scdr
>   996  scdr
>   997  exit
>   998  scdr
>   999  exit
>  1000  scdr
>  1001  man fc
>  1002  history 20
>
>fc 988
>opens vi with "cat rbhosts.txt" in the buffer
>
>When I see someone who only uses the arrow keys, I know they have not
>gotten serious about efficient command line use.
>> csh (sorry, no idea off the top of my head). 
>> 
>> Alternately, if you need a reason to use zsh, here's one more:  you
>can type
>> 'apt' and then use the up arrow to reverse through full commands in
>your
>> history that start with "apt".
>> 
>> 
>> 
>> 
>>
>
>----------------------------------------------------------------------
>Jim Wildman, CISSP, RHCE       jim at rossberry.com
>http://www.rossberry.net
>"Society in every state is a blessing, but Government, even in its best
>state, is a necessary evil; in its worst state, an intolerable one."
>Thomas Paine
>
>------------------------------------------------------------------------
>
>_______________________________________________
>colug-432 mailing list
>colug-432 at colug.net
>http://lists.colug.net/mailman/listinfo/colug-432

-- 
Sent from Kaiten Mail. Please excuse my brevity.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.colug.net/pipermail/colug-432/attachments/20140211/9d8141dd/attachment-0001.html 


More information about the colug-432 mailing list