How do you change user name in terminal

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
jacatone
Level 4
Level 4
Posts: 268
Joined: Fri Apr 18, 2008 5:23 pm

How do you change user name in terminal

Postby jacatone » Fri Jan 29, 2010 11:27 pm

How do you change say "joeblow@joeblow ~ $" to something else in the terminal? Thanks.

User avatar
RedWagon
Level 5
Level 5
Posts: 643
Joined: Tue May 26, 2009 6:41 pm

Re: How do you change user name in terminal

Postby RedWagon » Sat Jan 30, 2010 1:44 am

Run

Code: Select all

echo $PS1

and you should get something that looks like this:
${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\]
The part that shows what you see is the \u@\h in the middle. \u is the user, the @ is just an @ and \h is the hostname of your computer. To change what your prompt is, open your .bashrc file

Code: Select all

gedit ~/.bashrc

create a new line at the bottom and add

Code: Select all

PS1="

paste in the output from the echo $PS1 command above, add an extra quotation mark at the end to close the command, then replace \u@\h with whatever you want to see. When you're finished you should have something that looks like this:

Code: Select all

PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]joeblow\[\033[01;34m\] \w \$\[\033[00m\]"

save the file and open a new terminal window to see the fruits of your effort.

If you want to save time experimenting with different looks, you can just run the PS1="..." command straight in the terminal window. Just keep in mind that the changes won't stick until you add the command to your .bashrc file. In the future if you ever want to change or undo what you did, just open the .bashrc file again and delete the line you added and everything will go back to normal.


Return to “Newbie Questions”

Who is online

Users browsing this forum: No registered users and 19 guests