Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

When I connect to my VPS through terminal and I want see the previous commands I get:

$ ^[[A^[[A

(by pressing up arrow)

What is wrong with it ? How can I see unix previous commands instead ?


share|improve this question
up vote 5 down vote accepted

You are most likely using sh rather than bash or some other shell that allows command line editing. Try running bash and see what happens. If this fixes things for you then you will need to change the default shell for the account e.g.

usermod -s /bin/bash YourLogin
share|improve this answer
@lain how can I switch shell and use the other one ? – Patrick Nov 3 '10 at 21:40
@lain great thanks – Patrick Nov 3 '10 at 21:46
chsh also works to change the login shell. – Dennis Williamson Nov 3 '10 at 23:45

There is another pitfall if you have multiple shells open on the same user account: the history finally saved in the .history file will be that of the last shell closed.

share|improve this answer
This is true by default, but not by necessity -- see shopt -s histappend. (Note that bash won't see the history of other instances until history is reloaded, but you can stuff history -a; history -n into your PROMPT_COMMAND.) – jgoldschrafe Nov 4 '10 at 1:58

Alternatively, you can still use sh vi mode to get the command history:

set -o vi
<ESC> to get in command mode, K to go up the history.
share|improve this answer
I don't think this is a bourne shell feature. I'm not sure. Bash certainly has it, google suggests ksh does too. Solaris sh does not, neither does dash. So I would not rely on it being available in all situations. – jmtd Nov 4 '10 at 13:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.