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

In text editors, if I press the up and down arrow keys, it moves the cursor between lines of text.

In Bash, if I’m typing a long command that spans multiple lines and I press the up and down arrow keys, it cycles through the command history.

I want the former behavior in Bash. Is this possible? If not, is there any way to move the cursor directly up or down in a multi-line command?

share|improve this question
They move between lines... just that the line is very long. – vonbrand May 4 '13 at 1:58
up vote 11 down vote accepted

No, it's not possible. Bash uses GNU Readline to handle interactive line input. There is no command in Readline that moves between display lines as you desire, nor is there a configuration variable comparable to the line-move-visual variable of GNU Emacs that causes next-line and previous-line to move by display lines.

share|improve this answer
Disappointing, but thanks! And I think the answers to another question would be useful to people with this same question:… – Frungi May 11 '13 at 23:15

What I do is press CTRL + Left Arrow and it will leap to the first letter after the last space found. You can quickly get to where you need by doing this.

share|improve this answer
That's a non-standard key binding. The standard key binding for moving backwards by one word is Alt+b. See – sleske May 5 '13 at 10:42

Maybe you're looking for something like xiki. It's like a shell/text-editor.

Here's a video demo:

share|improve this answer
Xiki looks amazing! I want something like that that can run on windows... – Max May 10 '13 at 7:12
@Max according to the projects github page, "We just patched el4r, so there's a chance Xiki might work in windows." You can check it out here: – I-Ii May 11 '13 at 17:34
thanks for the tip – Max May 11 '13 at 22:00
This is startlingly neat and nerdy, but really not what I was wanting to do. I just wanted to use Bash or some other common shell. Thanks, though! – Frungi May 11 '13 at 23:22

You can use Ctrl+Left and Ctrl+Right to navigate through words rather than characters, and Home and End to go to the beginning and the end of the typed command.

share|improve this answer
Also, Ctrl+A to go to the beginning and Ctrl+E to go to the end – ignis May 4 '13 at 8:35
@ignis you should put that in an answer. – evilsoup May 4 '13 at 20:49

See also the bash(1) manpage under the heading Commands for Moving section for other navigation shortcuts.

share|improve this answer

Ctrl+A to go to the beginning and Ctrl+E to go to the end of the command.

share|improve this answer

You must log in to answer this question.

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