I am trying to change my current username on Linux Mint that shows up when I open a terminal window.
Currently:
john@myLinux
I want to change to:
gary@myLinux
I have tried:
(1) Start -> Settings -> Account Detail and altered the 'name' field.
(2) The steps mentioned here: https://askubuntu.com/questions/34074/how-do-i-change-my-username
(3) Altering the passwd file: https://www.cyberciti.biz/faq/understanding-etcpasswd-file-format/
Option #3 seems to affect the username displaying in the terminal window but causes issues with logging in(my password becomes incorrect).
How can I successfully change the username that is displayed in my terminal window on Linux Mint OS?
This assumes you are using bash
, and might not work for a different shell.
This will only change the terminal prompt text, it will not update your user account or change any other system files.
DEFAULT=$PS1
PS1='gary@\h\$ '
PS1=$DEFAULT
Note 1: Make sure to save these settings in your .bashrc
file under the home directory to have changes persist across terminal sessions.
Note 2: In step 2, \h
tells the bash prompt to print out the computer hostname, the \$
prints out show the (#) symbol if you're ROOT otherwise show the ($) symbol.
More information can be found here: https://www.howtogeek.com/307701/how-to-customize-and-colorize-your-bash-prompt/