Sunday, June 23, 2013

Add a Separator Between Terminal Commands

After running many commands in the terminal, it sometime gets difficult to read the outputs. I've seen many people hitting 'Enter' repeatedly just to separate those outputs. This neat trick would add a nice separator between each command and also makes the command bold. In addition to that it also adds a time-stamp at the end. The time-stamp is useful in knowing when a particular long-running command completed.

So the final result would look like this.

I'm going to show how to achieve this in Linux.
First, download the configuration file from here and save it in your home folder with the name .bash_ps1.

Then add the following code in the .bashrc file in your home folder.

if [ -f "$HOME/.bash_ps1" ]; then
. "$HOME/.bash_ps1"

Then restart the terminal. Now you should see an output similar to above.

Refer this article to get this done in Mac OS X.

Source :


Bhathiya Jayasekara said...

This one is great. Thanks for sharing.

Post a Comment