I have a newly-reimaged VPS server. Bash tab completion and history (via the arrow keys) works as expected on the root account but is totally absent on my lower-privileged account. I also can't navigate within a command I enter to fix typos by using the arrow keys - I just get something like ^[[D at the terminal instead. My .bashrc is

# enable bash completion in interactive shells
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion

Any thoughts on how to fix this problem? Thank you!

  • 2
    Is your $SHELL Bash or sh? – muru Jan 17 '17 at 12:52

Going by your description, none of bash's command line edition features work. I'm with muru: the most likely explanation is that you are not, in fact, running bash, but some different shell such as dash. Keep in mind that /bin/sh is not bash — some distributions install bash as /bin/sh, but Ubuntu doesn't.

Check what your login shell is:

getent passwd $USER

If the line ends with :/bin/bash, your login shell is bash. If it ends with :/bin/sh, your login shell is dash, which is a shell intended for scripting, not for interactive use.

Run chsh -s /bin/bash to change your login shell to bash. Before logging out, make sure verify that you can still log in on another terminal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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