[colug-432] Search Command History
Jim Wildman
jim at rossberry.com
Tue Feb 11 15:48:33 EST 2014
Sure, if what you want is in the last few commands, and you just want to
repeat that command. But say you need to redo the command, but change
it slightly and it was 5 days ago? And note that I used the word
efficient. ditto for use of vi or any other editor. There are better
ways than uparrow, backspace, etc.
And for the case of unreliable vpn...use screen on your destination,
along with the other tips.
Really my point is that there are MANY efficiency tools built into the
*nix command line. If you spend any time at all administering systems,
and especially if you get paid to do it, it pays to know them. If
nothing else, it will put you miles ahead of the arrow key guys in the
productivity department.
On Tue, 11 Feb 2014, Steve VanSlyck wrote:
>
> 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 typ
> e
> '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.
>
----------------------------------------------------------------------
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
More information about the colug-432
mailing list