Bash terminal prompt trick

This cool trick will transform one’s dull terminal to a fancy terminal with date + time and current Git branch if any.

Copy below code to your ~/.bashrc

export PS1='\[\033[0;32m\]\[\033[0m\033[0;38m\]\u\[\033[0;36m\]@\[\033[0;36m\]\h:\w\[\033[0;32m\]$(__git_ps1)\n\[\033[0;32m\]└─\[\033[0m\033[0;31m\] [\D{%F %T}] \$\[\033[0m\033[0;32m\] >>>\[\033[0m\] '

When done, source the bashrc file and then voila!!!

$ source ~/.bashrc

Dull Terminal

screenshot_2016-12-13_10-08-28

Epic Terminal with date, time and current git branch

screenshot_2016-12-13_10-07-58

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s