Color highlight & timestamp your bash cli prompt

 To color highlight your bash cli simply edit /etc/bash.bashrc and add the following lines:


force_color_prompt=yes

    if [ "$LOGNAME" = root ] || [ "`id -u`" -eq 0 ] ; then
        PS1='\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;34m\]#\033[00m\] '
    else
        PS1='\u@\h:\w\$ '
    fi
 

Example:

Additionally you can show the timestamp by adding export PROMPT_COMMAND="echo -n \[\$(date +%H:%M:%S)\]\ " into your ~/.bashrc file:

No comments:

Post a Comment

Color highlight & timestamp your bash cli prompt

 To color highlight your bash cli simply edit /etc/bash.bashrc and add the following lines: force_color_prompt=yes     if [ "$LOGNAME...