Support Forums

Full Version: Change username in Terminal from .bashrc
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm going to show you a way to change your username that appears in the terminal before every code that you execute. Mine looks like this:

[Image: Screenshot-1.png]

Where i've replaced "Jason-m40sjd00sd8f ~ $".... with a whole bunch of random numbers and letters.... Into "Infinity ~ $"

Here's how you can do it too.


First open a terminal and type:

Code:
sudo gedit ~/.bashrc

In .bashrc type:

Code:
PS1=" "

Keep this document open for now.

Open another terminal and type:
Code:
echo $PS1

You will end up with an output that looks something like \[\033[01;32m\]\u@\h\[\033[01;34m\] \w $\[\033[00m\]

copy the value that shows up into the .bashrc file and paste it into your .bashrc file in between the quotations in PS1=" ". From there, you'll now want to change the "\u@\h" to whatever you want your username to show up in the terminal.

Example:
Code:
\[\033[01;32m\]Infinity\[\033[01;34m\] \w $\[\033[00m\]

If you followed everything correctly you should have the .bashrc file looking something like this:

Code:
\[\033[01;32m\]Infinity\[\033[01;34m\] \w $\[\033[00m\]

Only instead of Infinity you will have your own username.
For users without gedit, like myself, this will also work,
Code:
sudo nano /etc/bashrc
I also took out the annoying fortune game today by editing one of the associated files.

Now upon opening a Terminal all I see is

Code:
Infinity ~ $