Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Let's say I entered a bunch of commands one after another:

rm blah.txt
pwd
ls
cd ..
cd blah
pwd

If I want to get "rm blah.txt" to appear again without typing the whole thing again, I can press up 6 times.

But is there a faster way? Can filter my command history based on some text?

Intuitively, I would like to just type in r and then press up to search through my command history for only commands that started with "r".

share|improve this question
3  
In bash it would be ctrl-r r m. What about installing cygwin? –  LatinSuD Aug 13 '14 at 17:17

2 Answers 2

up vote 10 down vote accepted

Hit F7 to bring up a list of the last few commands, then you can hit the first letter to jump to the first matching entry. Hit the same letter repeatedly to move up commands with the same first letter (working from newest from oldest).

enter image description here

share|improve this answer
    
ls? You're using GnuWin! –  Corey Ogburn Aug 13 '14 at 19:49
1  
@CoreyOgburn Actually, I did it as a joke. Glad you noticed. :) –  Ƭᴇcʜιᴇ007 Aug 13 '14 at 22:12
1  
ls is a command that I tend to always type when I first open cmd. –  Alvin Wong Aug 14 '14 at 2:17
1  
@Corey: ls and any other cygwin command can easily be run via the Windows command prompt: you just need to put the cygwin bin directory on the path. –  Adrian Pronk Aug 19 '14 at 10:17

On Win-XP (and maybe Win-7 too), type the first few letters of your command and press F8 to see the most recent command that started with those letters. If that's not the one you want, press F8 again, and so on. If you enter the command you select without modification, then you'll be positioned in the command history at the point when you originally entered the command and can use the up- and down-arrows to select the preceding or following commands.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.