Ubuntu – Arrow keys, Home, End, tab-complete keys not working in shell

bashcommand lineubuntu-minimal

I have installed ubuntu minimal(mini.iso) on my vm. I then used recovery mode to login as root and create an account with useradd -m admin and then set a password with passwd admin.

When I login on the new account, instead of the normal prompt I only see a $ sign. If I try to tab-complete a command or file name it prints a normal tab. If I try to use the arrow keys it prints ^[[A, ^[[B, ^[[C or ^[[D. Also, ls no longer adds colors.

None of these problems were in recovery mode. How can I fix this?

Best Answer

That probably means that the new user account was created with /bin/sh as its login shell (which symlinks to the dash shell by default) instead of /bin/bash - you can change a user's login shell with the 'chsh' command

chsh -s /bin/bash

or to change another user's login shell (need to be root to do this obviously)

sudo chsh -s /bin/bash <username>

(you will need to start a new login session for the change to take effect). You may also need to copy the default .bashrc from /etc/skel to get the color prompt.

In future you might want to use the 'adduser' command instead of 'useradd' - it sets up a more complete user environment including things like a default .profile and .bashrc - as well as setting the login shell to 'bash'