Content:
When opening a terminal window, the current user and PC name are displayed to the left of the prompt.
username@pcname ~ $
If you’re taking screenshots, recording videos, or sharing content with a public audience, you might not want this information to be visible.
To set these values, the terminal uses a variable named PS1
. You can check the current command used to set this value using
echo "$PS1"
On our system, this is currently set to
\[\e[01;32m\]\u@\h\[\e[01;34m\] \w \$\[\e[00m\]
You can temporarily change this using
export PS1=
and specifying the new naming rule you wish to use. For example, to show only a $
(or #
if you’re root), you can run
export PS1="\$ "
A full list of possible options can be found here.
Making the Change Permanent
If you only need to make the change temporarily, simply run your chosen command as required. However, if you want something more permanent, you’ll need to alter your .bash_profile
file.
nano ~/.bash_profile
Add the export command to the bottom of the file, and save the edited file. Reboot the system for the change to take effect.