[SOLVED] bash-4.2$: change the command prompt to display username who has logged in
Dragora GNU/Linux-LibreThis forum is for the discussion of Dragora Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Slackware14.2-64bit on one HDD, Slackware64-current on anotherHDD, VoidLinux on Libreboot laptop
Posts: 169
Rep:
bash-4.2$: change the command prompt to display username who has logged in
The /etc/skel directory was empty. Created .bash_profile, .bashrc, .bash_logout files. /etc/profile exists.
However much I try, unable to change the display of command prompt, to display the username
I would be glad if some body would clarify, how to make the terminal(bash) command prompt display the username of the user that has logged in, every time, automatically
Think I am missing something elementary, but I feel I am going round and round in circles, with .bashrc, .bash_profile, /etc/profile files
One of two things happened. Either the directory /root was deleted; or a missing / corrupt .bashrc file in /root (.bashrc sources /etc/bashrc, which sets the prompt), you can run the following command to restore the original files (which are copied automatically when the root or any user account is created). Run this command as the user who is having problems OR define the destination path to /home/directory/user/
cp -v /etc/skel/.bash* ~/ #if logged in as user
cp -v /etc/skel/.bash* /home/user/ #run as root
Should replace the .bash_logout, .bash_profile and .bashrc - exit terminal and log back in. The -bash-4.1# should now be gone!
This solved my issue. bash prompt below
Quote:
san2ban@KRISHNA:~$
Quote:
root@KRISHNA:/home/san2ban#
But, in future, if I have to make changes to my .bashrc, should I do it at /home/san2ban/.bashrc or /etc/skel/.bashrc ?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.