How do you change user name in terminal

Quick to answer questions about finding your way around Linux Mint as a new user.
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. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
RedWagon

Re: How do you change user name in terminal

Post 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.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Locked

Return to “Beginner Questions”