Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

rm blah.txt
cd ..
cd blah

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
In bash it would be ctrl-r r m. What about installing cygwin? – LatinSuD Aug 13 '14 at 17:17
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
@CoreyOgburn Actually, I did it as a joke. Glad you noticed. :) – Ƭᴇcʜιᴇ007 Aug 13 '14 at 22:12
ls is a command that I tend to always type when I first open cmd. – Alvin Wong Aug 14 '14 at 2:17
@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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .