OS X Terminal: Jumping Around in Command Text

| TMO Quick Tip

Something that even longtime users of the Terminal may not know is that you can hop around in a command you’ve typed, eliminating the need to use the arrow keys to move letter by letter. It’s pretty simple, really—hold down the Option key, and your cursor will turn into a little crosshairs symbol. Then just click anywhere in the line, and you’ll jump to that insertion point.

Heads up—I’ve noticed some weirdness if I try to do this when my Terminal window is small enough that the command flows onto multiple lines. 

If that happens to you, just embiggen your window, and you’ll be fine.

Another happy little trick is that you can use Option paired with the left or right arrow key to jump between sections of your typed command (sadly, this is Lion- and Mountain Lion-only). Here’s an example of all the places that your cursor will leap to if you start at the line’s end and continue pressing Option–Left Arrow:

No mouse or trackpad required for that!

And finally, if you’d like to jump right to the beginning or the end of a line in Terminal, use Control-A (beginning) or Control-E (end). Pretty handy stuff if you use Terminal a lot! Or handy even if you know nothing about Terminal and just want to pretend to be a command-line wizard to impress your mom.

Popular TMO Stories



I didn’t know ctr-A or ctr-E.  I use shift-pageup and shift-pagedown which worked in Snow Leopard too.

Thanks for the tips about Lion+ new features. I didn’t know they made these improvements! (And I spend a huge portion of my day in the Terminal.)

Melissa Holt

Happy to help, webjprgm!



ctrl-A and ctrl-E are also available in other Cocoa(?) based apps, anywhere you’ve got text editing available - not just Terminal.  For example, the address bar of Safari.

I recall reading that these shortcuts were originally used in the Emacs command-line editor family, and other similarly derived shortcuts are also available.  I think they’ve been around for a long time in OS X.  I’ve got this in 10.6 here on my office machine, but I think they date back to at least 10.5 and possibly well before that.

Another nice one - one which I sometime find myself using - is the ‘twiddle’ command.  If you’ve mistyped a word by swapping two charactres, position the cursor between them and press ctrl-T…  It depends on your dexterity, fingeratively speaking, but it can provide a quicker way to fix such errors than retypign them.

Melissa Holt

Thanks for the additional tips, Gary! I’m sure folks will find those very helpful. smile



Another handy shortcut is ctrl-W which deletes the previous word back to the previous whitespace.

Actually it deletes from the cursor position up-to but not including the previous whitespace character or the character the cursor is on.

Also ctrl-U deletes everything to the left of the cursor back to the beginning of the line.

And don’t forget TAB completion. Type part of a command and hit tab to complete it. If it beeps at you then that means there is more than one possible completion and if you hit tab again it will list the possible choices—then just type enough characters to uniquely identify it and press tab again and terminal will fill in the rest. This also works great when typing filenames or path names.

Also if you’re a touch typist and don’t like moving you hand to the arrow keys you can use ctrl-B and ctrl-F to move the cursor backward and forward respectively.

ctrl-D deletes the current character.

Melissa Holt

Thanks, TheMikester! I appreciate you posting such excellent tips.



Another tip I meant to mention earlier is that you can drag a file or folder to the terminal window and it will fill in the full path to that file.

That is a real time and typing saver. I use it a lot when either changing directories or when copying a file.

Isaac Alves

at home i’m able to jump around words too when pressing “option + left/right arrow” in terminal, but at my computer at work (mavericks on both), it just outputs ‘[D’ and ‘[C’ .

Melissa Holt

Hey Issac,

Check out this discussion—it may be helpful to you:



Log in to comment (TMO, Twitter or Facebook) or Register for a TMO account