If you do "!se" you'll execute the most recent command that starts with the letters "se". I find I use this more than re-executing by number.
Curt On Wed, Jan 6, 2010 at 6:41 PM, Perkins, Jerry <[email protected]> wrote: > Dave, this is even new to me, so I am also sending it on to a couple > others. > > Reuse your history > > After some time learning and experimenting at the command line, you'll find > that you want to go back and repeat a command you executed at some point > during the past. Luckily, Unix (and Cygwin) track every single command you > ever type in a file called .history. Type the history command to see the > last 100 commands you ran, which will be numbered, like this: > > penel...@scully ~ > $ history > .... > 82 echo gift-ideas.txt > 83 grep Mom gift-ideas.txt > 84 man grep > 85 ls | grep .txt > 86 ls > 87 ls | grep todo > 88 ls | grep .txt > 89 ls >> file-listing.txt > 90 cat file-listing.txt > 91 history > > > Now, if you want to redo command number 87, let's say, you don't have to > retype it. The "bang" (exclamation point) and the command number will get > the job done. Just type !87 at the prompt, hit enter, and - in my case - ls > | grep todo - will be re-executed. > > Use grep to pick out the command of interest from your history. For > example, to see all the ls recipes you've used in the past, grep your > history for ls, like so: > > penel...@scully ~ > $ history | grep ls > 11 ls > 13 ls > 14 cls > 20 ls > 21 ls > 27 ls > 46 man ls > 47 ls -l > 48 ls > 49 man ls > 50 ls -lh > 51 ls > ... > > > Neat, huh? > > -- > Jerry Perkins - http://jperkins.us/ > > Calling an illegal immigrant an undocumented worker > is like calling the corner drug dealer an unlicensed Pharmacist. > > >
-- You received this message because you are subscribed to the Google Groups "NLUG" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nlug-talk?hl=en
