Ubuntu – How to change the display name on the Terminal?

command linehostnameusername

When I open the terminal, a name is displayed before I type any command as follows:

administrator@administrator:~$

What specific steps do I take to change the display name?

Best Answer

  • This actually displays your username@computername: along with the current directory and a $ sign, which usually means a non-root user, whereas a # sign would mean that you have root permissions.

    Now, to only change what's displayed, you can edit your ~/.bashrc file. Open it with your favorite text editor and make changes to the line that starts with PS1=.

    If you have more than one line starting with PS1=, try changing them one by one, while saving the .bashrc file and opening a new terminal each time, to see if you edited the right one.

    To just experiment with what's displayed, without messing up anything, you can type export PS1="whatever you want". Once you close and reopen the terminal, it will set the value of PS1 back to the one in your ~/.bashrc file.

    To actually change your username or computer name, there are already excellent answers:

    You will need to log out and log in again to see the changes, unless you're changing the name of your computer, for which you'll need to reboot the machine.

  • Related Question