currently I have " carlos@hoffman-c:~$ " I need to change the above to read " hamburg@hoffman-c:~$ " I need to preserve all my settings data etc. Thank you in advance.

  • 2
    do you want to change username or computer-name? do you want to change only what prints in your prompt? why do you want to change it? – Yaron Feb 26 '17 at 9:37
  • 1
    Actually, 'carlos' is your username, not your hostname. You can rename it, or create a new user 'hamburg'. – RoseHosting Feb 26 '17 at 9:47

Your computer name (hostname) is the name you see after the @ sign.

Your username (userid) is the name you see before the @ sign.

You ask for how to change your computer name. But you indicate a different username for your prompt.

To make your prompt look the way you have indicated in your question. First log out. Then log into the console with this keyboard shortcut: Ctl+Alt+F2.

You can't change your userID while you are logged in with it. So you will have to logout. Create 9r user a different userID to do this.

Log into the console and follow these step. At the console prompt type this and press ENTER:

Create a new user:

$ sudo useradd tempuser
$ sudo adduser tempuser sudo
$ sudo passwd tempuser
$ exit

Now log in as the "different user". From that account run these commands. Replace the "newUsername" and "oldUsername" with "carlos" and "hamburg". In the commands below the -l changes the login ID. the -c changes the way it looks on the login screen.

$ sudo usermod -l newUsername oldUsername
$ sudo usermod -c newUsername newUsername
$ exit

Now hit the keyboard shortcut: Ctl+Alt+F7 to go back to your normal login screen.

Now login by the new changed name. When you log in your prompt will look the way you have specified in your Question.

Once logged in your can use System Settings -> User Accounts to remove the tempuser id.

| improve this answer | |
  • There is a typo on the create new user section: sudo adduser **tempuesr** sudo – M. Becerra Feb 26 '17 at 10:35
  • @M.Becerra Thanks for the critique. I'll fix it now. – L. D. James Feb 26 '17 at 10:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.