Linux/Unix prompt showing a $ instead of the login name and path. How to fix it.
Sometime you face and issue like your unix/linux terminal prompt is showing dollar sign "$" instead of the user login name and path. So in this blogpost we will see and learn ho to fix it.
Why prompt is showing $?
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.
How to fix it?
Follow below steps to fix shell path for newly created user's login.
1) You can check by looking in the /etc/passwd file, or using
getent passwd "username"
2) and you can change the default shell to the more usual bash using
chsh -s /bin/bash
3) if you are logged in as the user whose shell you want to change, or to change another account's login shell.
sudo chsh -s /bin/bash "username"
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.
That's all in this post. If you liked this blog and interested in knowing more about UNIX / LINUX / AIX. Please Like, Follow, Share & Subscribe to www.ImJhaChandan.com
Comments