QuickNote: Updating your Bash Prompt
1 min readApr 4, 2018
There are a million guides out there but as I always googled this I thought I would post the answer here.
Simple set the PS1 environmental variable in to .bashrc or .bash_profile
PS1=’#[\D{%F %T}] $(whoami)\e[0m \e[1m$PWD$/ \e[0m >>> ‘
this gives me
#[2018–04–04 08:45:21] cminion /home/cminion$/ >>>
Where
\D{%F %T} - provides the date
$PWD$ - provides the pwd output
whoami - provides the current user
Note: that if you use commands like date or pwd in there it will take the first value when the PS1 is set (i.e. when a new bash prompt is opened).