I want to change the user that is shown in the linux terminal. Try with this command
sudo usermod -c "Nuevo-Nombre-Usuario" nombredeusuario
But he does not do it, he always keeps showing me the same user in the terminal.
I want to change the user that is shown in the linux terminal. Try with this command
sudo usermod -c "Nuevo-Nombre-Usuario" nombredeusuario
But he does not do it, he always keeps showing me the same user in the terminal.
sudo usermod -l NuevoNombre AntiguoNombre
As indicated by the usermod documentation:
-l, --login NEW_LOGIN
The name of the user will be changed from LOGIN to NEW_LOGIN. Nothing else is changed. In particular, the user's home directory name should probably be changed manually to reflect the new login name.
Whose translation would be:
-l, --login NEW_LOGIN
El nombre del usuario se cambiará de LOGIN a NEW_LOGIN. Nada más cambia. En particular, el nombre del directorio de inicio del usuario probablemente debería cambiarse manualmente para reflejar el nuevo nombre de inicio de sesión.
Note: You can either use
sudo
, or you can also log in as root and execute the command from there. Although it is highly recommended to log in as root , since there are processes that are executed by your user to which your terminal will show an error.
Context: I currently have a user named username , I'm going to change the name, now it will be debian strong>, for this, I will start session as
root
and then just execute the previously explained command.
For the case that you use Ubuntu, I would recommend that you do the following:
1) Enter your terminal as root:
sudo -i
2) Change the root
key:
passwd
3) Close session in Ubuntu. 4) Enter a virtual terminal, executing the combination:
Ctrl Alt F4
5) Log in as root
.
6) Execute the command:
usermod -l NuevoNombre AntiguoNombre
7) Return to your graphic session:
Ctrl Alt F7
8) Log in.
If you only want to change the name that is displayed in the console, simply change the value of PS1
in ~/.bashrc
[eduen@EDUENPC ~]$ cat ~/.bashrc
#
# ~/.bashrc
#
alias subl="subl3"
alias ls="ls --color=auto"
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
PS1='[\u@\h \W]\$ '
In your specific case
PS1='[Nuevo-Nombre-Usuario@\h \W]\$ '
Save changes and go.
You can also directly change the value in console
[eduen@EDUENPC Escritorio]$ PS1='[Prueba@\h \W]$'
[Prueba@EDUENPC Escritorio]$