1

I'm trying to change the name that is listed as "user" under my desired username. This is the only account I have set up (= root account?).

I noticed that the name "user" instead of the account username appears in the terminal ("user"@). Note that my computer name has been set up as "ub".

How do I change the text under my username from "user" to match that of my username?

Screenshot:

I'm a newbie with ubuntu so if someone can list out clear step-by-step instructions I would be most grateful.

Thanks!

edwinksl
  • 24,109
user604803
  • 91
  • 3
  • 4
  • 10

1 Answers1

1

enter code hereThe out put is showing you your username which is user.

You can either change your username or change the PS1 variable. Only do #1 or #2.

#1 Change your username to a name of your choice

The best way is to login via different account. The specific user account can't be active when making this modification. So you may have to create a temporary account with sudo active, if you don't already have one.

Then from the other account run this command:

$ sudo usermod -l newname user

The parameter user is the current name being changed. The newname is what it's being changed to.

Then you will have to move the directory to that new name. Do this with:

$ sudo usermod -d /home/user -m newname

#2 Change the PS1 variable in your ~/.bashrc file

If you just want to have your name displayed in a special way you can edit the PS1variable in your ~/.bashrc file. You can use the line below or any other variation. In this case the newname in the line is what you would change to what you want to appear in your terminal prompt.

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]newname@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

Adding user from the commandline

You can add a user from the commandline with:

$ sudo adduser usernametoadd

You can add this user to sudoer access with:

$ sudo adduser usernametoadd sudo
L. D. James
  • 25,444