Hello,
I would like to ask how could I change the user name in bash prompt?
For example: from 'tom@dell ~ $' to 'dan@dell ~ $'
Thank you in advance
change user name in bash prompt
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Topics in this forum are automatically closed 6 months after creation.
change user name in bash prompt
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: change user name in bash prompt
Look in Control Center (Settings) Users and Groups
You can change the name there
You can change the name there
Everything in life was difficult before it became easy.
Re: change user name in bash prompt
Sorry, ths will not work, as it only changes the display name but not the technical user name. There are many things related with this and things are likely to get broken by changing it.
Create a new user account with the changed name, than copy (don't move!) the user data from the old into the new account.
Attention: Don't miss to add the new account into the group sudo, before you you remove the old one, otherwise you will fall in troubles.
Create a new user account with the changed name, than copy (don't move!) the user data from the old into the new account.
Attention: Don't miss to add the new account into the group sudo, before you you remove the old one, otherwise you will fall in troubles.
Re: change user name in bash prompt
Actually you can change it to whatever you want.
Use the following line in your ~/.bashrc
You can copy and paste it in the terminal to test it out
Use the following line in your ~/.bashrc
Code: Select all
! [[ ${EUID} == 0 ]] && PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\][dan@\h]\[\033[01;34m\] \w \$\[\033[00m\] ' || \
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u\[\033[01;34m\] \W \$\[\033[00m\] '
Re: change user name in bash prompt
Unfortunately I do not have .bashrc file in my home directory.WharfRat wrote:Actually you can change it to whatever you want.
Use the following line in your ~/.bashrc
You can copy and paste it in the terminal to test it outCode: Select all
! [[ ${EUID} == 0 ]] && PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\][dan@\h]\[\033[01;34m\] \w \$\[\033[00m\] ' || \ PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u\[\033[01;34m\] \W \$\[\033[00m\] '
- austin.texas
- Level 20
- Posts: 12003
- Joined: Tue Nov 17, 2009 3:57 pm
- Location: at /home
Re: change user name in bash prompt
That is no problem. Paste the command into a new text file and save the file as .bashrcckonn wrote:Unfortunately I do not have .bashrc file in my home directory.
Log out and back in to see the effect.
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2018
Linux Linx 2018
Re: change user name in bash prompt
It works! It's beautiful! Really, really beautiful!austin.texas wrote:That is no problem. Paste the command into a new text file and save the file as .bashrcckonn wrote:Unfortunately I do not have .bashrc file in my home directory.
Log out and back in to see the effect.
A Big Thanks to everyone!
Re: change user name in bash prompt
To read more about the command prompt:
Bash Reference - Controlling the Prompt
Bash Prompt HOWTO
Bash - Colors and formatting
Read about PS1, prompting, and .bashrc in
If easier, man pages can be read in your browser in html format using the
Bash Reference - Controlling the Prompt
Bash Prompt HOWTO
Bash - Colors and formatting
Read about PS1, prompting, and .bashrc in
man bash
. If easier, man pages can be read in your browser in html format using the
-H
option, man -H bash
.