Frank Cheng
Frank Cheng

Reputation: 6206

How to scroll up one line in terminal?

When I enter several lines command and the cursor is at the end of the last line. But I if I want to edit the last line command, how can I do it. For now I can only type several times till I reach the beginning of the line and then move to the line above.

The command is like this:

➜  src git:(master) ./configure --with-features=huge \
>                   --enable-rubyinterp \
>                   --enable-pythoninterp \
>                   --enable-perlinterp \
>                   --enable-cscope

Upvotes: 1

Views: 4568

Answers (2)

Ihab Shoully
Ihab Shoully

Reputation: 2321

If you want to move the cursor inside the line itself, try ShiftCtrl & ShiftCtrl, and if you want to jump between commands, just try .

More shortcuts:

Ctrl + A or Home take you to the beginning of the line.

Ctrl + E or End take you to the end of the line.

Alt + B take you left (back) one word.

Alt + F take you right (forward) one word.

More information here: The Keyboard Shortcuts for Bash

Upvotes: 5

Conner
Conner

Reputation: 31090

In Bash, you can open up the command in a text editor with CTRL-XCTRL-E so long as your $EDITOR environment variable is set. To set it you can export EDITOR=vim or put that in your .bashrc.

zsh do the same thing, but a keybinding needs to be configured.

Upvotes: 2

Related Questions