Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

How can I configure my Linux terminal so that the current command isn't lost when I press the up arrow key?

share|improve this question

migrated from serverfault.com Aug 18 '11 at 6:10

This question came from our site for system and network administrators.

If you press the down key it should come back (assuming bash). This is part of bash's history ability - every time you press up, you see the previous command, pressing down you see the most recent, including what you just typed. Effectively, in this instance, your 'undo'. – Chad Feller Aug 18 '11 at 4:04
It doesn't comeback when you type fast. – telnet Aug 18 '11 at 4:21
What shell are you using & which terminal configuration (echo $SHELL; echo $TERM). – O G Aug 18 '11 at 5:18

Add this to your .profile, .bashrc or .bash_profile:

bind -r "\e[A"

Then save the file. This will take effect when you open your next terminal (load it immediately with . <file> or source <file>).

This will unbind the Up arrow key from accessing your history. You can still use ctrl+P to move to the previous history item and ctrl+N to move to the next history item.

To unbind both up and down arrow keys, use this:

bind -r "\e[A"
bind -r "\e[B"
share|improve this answer

Your Answer


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