why is there no name showing at the command line?
If you added the new account using useradd
then it likely set the new user's login shell to be /bin/sh, which in Ubuntu is a symbolic link to the dash shell. Dash is a simpler shell which doesn't read the ~/.bashrc file and doesn't set the user@host command line prompt. You can check by looking in the /etc/passwd file, or using
getent passwd username
and you can change the default shell to the more usual bash
using
chsh -s /bin/bash
if you are logged in as the user whose shell you want to change, or
sudo chsh -s /bin/bash username
to change another account's login shell. To prevent this happening again, you can either specify the login shell on the useradd
command line using the -s
or --shell
options, or use the higher-level utility adduser
instead.
The basic Bash prompt is just a variable named PS1. This variable is usually set up in the ~/.bashrc file. The bash shell reads that file when it starts and sets up the variable. If the PS1 variable is not set up in the .bashrc (or .profile) file, then it you will have no prompt. In your case the PS1 variable is set to $:
export PS1="\$"
You can experiment with the variable, e.g try:
export PS1="\u\$"
export PS1="\u@\h\$"
You will see how the prompt changes. Edit your bashrc file the way you want your prompt to be shown. For more info go here.