enter code here
The 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 PS1
variable 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
echo "$PS1"
?whoami ; echo $HOME
at the command prompt?echo "$PS1"
in Terminal is\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]u@\h\[\033[00m\]:[\033[01;34m\]\w\[\033[00m\]\$
@L.D.James Output ofwhoami ; echo $HOME
in Terminal isuser /home/user
with a line brake after the firstuser
before/home ...
user
. You can change your username to something different, or you can edit your$PS1
variable to output any other specification outside of your actual username. As per your question, I'll outline in a formatted answer how to do it both ways.