After creating a new user with adduser username, you might encounter a surprisingly minimal terminal experience:
$
Compared to root's fully-featured prompt:
root@lin01:~#
The stripped-down environment typically lacks:
- Hostname and username display
- Directory path in prompt
- Tab completion
- Syntax highlighting
- Command history
This occurs because new users are often assigned /bin/sh (a basic shell) instead of /bin/bash. Verify with:
echo $SHELL
If it shows /bin/sh, we've found our issue.
While logged in as the affected user, execute:
chsh -s /bin/bash
Then log out and back in. For immediate application without relogging:
exec bash
Confirm the change took effect:
grep ^username /etc/passwd
Should display /bin/bash at the end. If issues persist, check:
ls -l /bin/sh
Some systems symlink sh to dash instead of bash.
To customize your new bash environment:
nano ~/.bashrc
Add these common enhancements:
# Enable color support
force_color_prompt=yes
# Better prompt
PS1='${debian_chroot:+($debian_chroot)}$$\033[01;32m$$\u@\h$$\033[00m$$:$$\033[01;34m$$\w$$\033[00m$$\$ '
# Enable programmable completion
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
fi
fi
When creating new users on Linux systems, you might encounter a situation where the terminal shows just a bare $ prompt instead of the full-featured prompt you're accustomed to. This typically indicates either:
1. The user was assigned a different default shell
2. Shell configuration files are missing
3. Environment variables aren't properly set
The first thing to check is which shell your new user has been assigned. Run:
cat /etc/passwd | grep username
You might see output like:
username:x:1001:1001::/home/username:/bin/sh
Notice the /bin/sh at the end - this indicates the default shell. Many Linux systems default to the minimal Bourne shell (sh) for new users rather than bash.
To switch to bash (which provides all the expected features), use:
chsh -s /bin/bash
After changing shells, log out and log back in. You should now see a proper prompt like:
username@hostname:~$
If tab completion and highlighting still don't work, we need to check the bash configuration.
Sometimes the skeleton files (/etc/skel) aren't properly copied during user creation. Check if these essential files exist in your home directory:
ls -la ~/ | grep -E '\.bashrc|\.profile|\.bash_profile'
If they're missing, you can copy them from the skeleton directory:
cp /etc/skel/.bashrc /etc/skel/.profile ~/
Then source them to apply changes:
source ~/.bashrc
source ~/.profile
For those who want more control over their prompt appearance, you can edit ~/.bashrc and look for the PS1 variable. Here's a robust example:
# Custom prompt in ~/.bashrc
PS1='$$\e[1;32m$$\u@\h$$\e[0m$$:$$\e[1;34m$$\w$$\e[0m$$\$ '
This creates a colored prompt showing username, hostname, and current directory.
If problems persist after these steps, check:
1. Permissions: ls -ld ~/
2. Environment variables: printenv
3. Shell initialization order: which files are being sourced
For complete debugging, you can trace shell initialization:
bash -x