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

I am using bash on a virtual machine. For some reason arrow keys don't work there. Is it possible to use some other key kombination (like HJKL in vi) to move left/right/up/down?

(it's OpenBSD if it helps)

edit: I will also add I know the reason why they don't work and it's pretty much unfixable (and it's not the problem I want to solve right now)

share|improve this question
up vote 10 down vote accepted

Try this:

set -o vi

Then use Esc and 'hjkl' to navigate.

You can also do this:

set -o emacs

And use ctrl-p, ctrl-n, etc. for navigation.

I have VI mode set in my .bashrc so it's immediately available.

EDIT: here's a cheat sheet for VI mode in Bash. It's a PDF, so consider yourself warned ;)

Here's a cheat sheet for Emacs mode in Bash -- just to cover my bases. It's also a PDF.

share|improve this answer
    
it was faster than I thought! :) thanks – Karel Bílek Jan 4 '10 at 3:36
    
Glad to help :) I'm posting a link w/a cheat sheet for VI: warning, PDF. – bedwyr Jan 4 '10 at 3:38

In Emacs mode, it's Ctrl-B and F (backward and forward one character), and Ctrl-P and N (previous and next line)

share|improve this answer

The arrow keys on the numpad also work (4,8,6,2) and send a different keycode.

share|improve this answer

You must log in to answer this question.

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