LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Dragora GNU/Linux-Libre
User Name
Password
Dragora GNU/Linux-Libre This forum is for the discussion of Dragora Linux.

Notices


Reply
  Search this Thread
Old 03-08-2017, 09:51 PM   #1
san2ban
Member
 
Registered: May 2013
Location: Bengaluru / India
Distribution: Slackware14.2-64bit on one HDD, Slackware64-current on anotherHDD, VoidLinux on Libreboot laptop
Posts: 169

Rep: Reputation: Disabled
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

This will be a lesson for me
 
Old 03-09-2017, 12:28 AM   #2
san2ban
Member
 
Registered: May 2013
Location: Bengaluru / India
Distribution: Slackware14.2-64bit on one HDD, Slackware64-current on anotherHDD, VoidLinux on Libreboot laptop
Posts: 169

Original Poster
Rep: Reputation: Disabled
In the below link
http://unix.stackexchange.com/questi...t-show-anymore

It was mentioned as below
Quote:
4
down vote


I had the same issue, here’s how I solved it:

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 ?
 
Old 03-09-2017, 01:29 AM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by san2ban View Post
But, in future, if I have to make changes to my .bashrc, should I do it at /home/san2ban/.bashrc or /etc/skel/.bashrc ?
in your $HOME.

and please mark the thread solved (Thread Tools at the top).
 
Old 03-09-2017, 01:48 PM   #4
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
You are aware that you only need to replace a single line of code in your bashrc file;

Code:
PS1="\u@\h: "
This will display the uses name.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Display-bash-4.2#, not changing to my username san2ban Slackware 20 02-21-2019 06:28 AM
Looking for a bash script which will prompt to enter host & username at initial boot. abc_19 Ubuntu 2 02-17-2011 10:52 AM
[Help in Bash Scripting] Display real name from username logged in + user processes leoboy1986 Programming 1 01-14-2011 01:11 PM
help! bash command prompt font/color change richiangpan9 Linux - Newbie 3 04-24-2005 11:34 AM
command prompt - username@mac address? ryedunn Linux - Newbie 5 03-16-2004 07:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Dragora GNU/Linux-Libre

All times are GMT -5. The time now is 03:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration