Page 1 of 1

Re: How do you change user name in terminal

Posted: Sat Jan 30, 2010 1:44 am
by RedWagon
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.