94

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?

  • 1
    The $ prompt is for a user. root's prompt is #. The arrow keys do not work in terminal, you need to type in something like unity to run the Unity shell – SimplySimon Jul 28 '13 at 20:12
  • 3
    @SimplySimon The up and down arrow keys are supposed to switch through previous commands, the left and right arrow keys are supposed to scroll through the current command, and tab should complete the command or file name. The path should be written to the left of the $... – Runemoro Jul 28 '13 at 20:18
  • Very true, of course they do. sorry – SimplySimon Jul 28 '13 at 20:22
179

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

sudo chsh -s /bin/bash <username>

(you will need to log out and back in 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'

  • 16
    Additional tip: A user may change this for their own account without requiring sudo rights (just omit sudo in above command). – Cedric Reichenbach Feb 17 '15 at 16:20
  • 4
    Actually, you don't have to log out. Just invoke it by typing in /bin/bash at the prompt. Same thing goes if you modify your bash.rc file. To see the changes you do the same thing. – SDsolar May 14 '18 at 18:41
5

I was unable to use tab completion when connecting via VNC to a headless XFCE4. The answer listed here did not work but this did:

Edit Keyboard Shortcuts in xml file:

sudo nano ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml

Find:

<property name="&lt;Super&gt;Tab" type="string" value="switch_window_key"/>

Change it to:

<property name="&lt;Super&gt;Tab" type="empty"/>

Logout/reboot and should be good to go

2

I just installed Vim and everything was solved. At first, I thought that it was installed on the original version of Ubuntu since I was able to use Vi command, but it was not the case.

sudo apt-get install vim 

solved the problem.

  • The selected answer didn't work for me, but this did. – Aaron Cicali Mar 5 at 2:08
-1

This will solve all: paste and press . After that you will be able to auto-complete from the history, using arrow up.

bind '"\e[A": history-search-backward'

Taken from: https://unix.stackexchange.com/questions/5366/command-line-completion-from-command-history Also you can use Ctrl + R to see your history.

  • It will work for all modifications of Linux – Josef Klimuk Jul 9 '18 at 13:37

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.