Basic Keyboard Shortcuts For The Windows Command Line

We recently ran a post on useful keyboard shortcuts and other tricks for the terminal in Mac OS X and on Linux boxes. Those options don't all exist for a standard Windows installation, but the Windows command line does have some useful keyboard shortcuts on offer.

You can get the full Unix-style command line experience in Windows by installing Cygwin, but that's overkill for many people. However, even in its standard form the Windows command line can be useful for tricks such as producing a list of all the files in a given directory, and some more advanced Windows tweaks are still only accessible via the command line.

Once you've got a command line up and running (typing cmd into the Windows search box is a fast way to access it), here's the useful keyboard shortcuts you can use. Normal editing keys will work as you'd expect, so you can use Home, End and the arrow keys to move around. If you want a basic understanding of command line options, many of the basics explained in our earlier command line primer work in Windows. Up and down arrows: Cycle through commands you've typed in the terminal.

Tab: If you're typing a command which includes part of a directory name, Tab will autocomplete it. If you hit Tab on its own, it will cycle through the subdirectories under the directory you are currently in in alphabetical order. Shift-Tab does the same in reverse alphabetical order. F1: Retypes the previous command one character at a time. F2 followed by a letter: Retypes the previous command up until that letter. F3: Retypes the last command in its entirety. F4 followed by a letter: Retypes the previous command with the content up to that letter deleted. F5: Goes back one command line. F7: Produces a list of recent commands you can scroll through. (There's a number listed next to each command — you can type F9 and then that number for even quicker access.) F8: Cycles back through previous commands. If you type a letter or letters before hitting F8, only commands that start with those characters will be included.

Lifehacker 101 is a weekly feature covering fundamental techniques that Lifehacker constantly refers to, explaining them step-by-step. Hey, we were all newbies once, right?


    F4 doesn't seem to work for me, can anyone provide an example?

    F5 and the up arrow seem to be synonymous.

    Pressing the up arrow key does the same as F3 and right arrow does the same as F1.

    Although I've used DOS since about '88 and never knew any of these! Im a bit stunned...

      I'm pretty sure a lot of these didn't existing in DOS in 1988 (though F3 might have).

Join the discussion!

Trending Stories Right Now