#
Changing bash prompt on your server
#
Changing bash prompt on your server
Let's start with what the hell is bash prompt. It's simple, whenever you're in your bash terminal, you see your username and hostname before the input field:
Username
Hostname
thinkpad
workstation
We can change it however we want, using bash color formatting and bash prompt variables
Custom prompt should be specified in the bottom line of your user .bashrc
file, which is located in your home folder:
nano ~/.bashrc
Here's example of prompt I'm using on my servers:
PS1="\e[35m[ \H\[\033[01;34m\] ] \t \w #\e[0m "
.bashrc
file with custom prompt variable: PS1
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
#My custom bash prompt
PS="\e[35m\H\[\033[01;34m\] \t \w #\e[0m "
Then we update our bash prompt by typing:
source ~/.bashrc