No Linux No Life – How to Modify Command Prompt

The less is more.

By default, the Linux system’s Terminal prompt displays the full path of your current directory, which can sometimes be cumbersome, especially when navigating deep into a directory structure. So, here’s what I did to make the user prompt shorter, simpler, and more user-friendly.

vim ~/.bashrc
if [ "$color_prompt" = yes ]; then
    #PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
    PS1='\[\e[32m\]$(whoami):\[\e[34m\]\W\[\e[0m\]\$ '
else
    PS1='\W\$ '
fi
source ~/.bashrc

Leave a Reply