Add a Separator & Time Stamp Between Terminal Commands to Increase Readability
If you want to customize the Terminals appearance a bit beyond the prompt and a custom background, you can make the Terminal much more readable by using this nice trick to add a separator and timestamp between each executed command. This also bolds the current command text and anything that is available from tab completion.
To get this to work, you just need to paste a script into your .bash_profile. Here’s how to do this, including how to make a backup of your existing bash profile in case you mess something up:
- Open the Terminal and type ‘cd’ to make sure you are at the home directory
- Backup your existing .bash_profile by typing:
- Now open .bash_profile with nano (or your preferred text editor):
- Navigate to the end of .bash_profile and copy and paste the code below, depending on which you want to display:
cp .bash_profile .bash_profile-backup
(If you have trouble viewing the embedded code, you can see the standard version here or opt for the excellent Vulcan Spock Salute version here) The embedded code below is the standard version:
- Now hit Control+O to save the changes, then hit Control+X to exit out of nano
- Open a new Terminal window and start entering commands to see the separator
Remember if you want to revert this you can either delete the code from bash_profile or just go back and replace it with your backed up copy, named .bash_profile-backup and located in your home directory.
This is what the revised Paul Prompt with Vulcan Emoji looks like, you can find this on Github:
And here’s the original version covered by AJ, with a simple divider but no color ls output and no Emoji prompt:
Pick whichever you prefer.
This is a pretty nice way to customize the command line a bit and make it easier to read, but it’s not nearly as dramatic as TermKit or some of the other crazier options out there.
As long as you’re using bash you should be able to do the same with other variations of unix too. This is a cool little trick that Lifehacker modified from Emilis Dambauskas, you can get a different variation for Linux at either of those sites if for some reason this one doesn’t work for you. Thanks to Marcus for sending this to us.
(Updated by Paul on 4/20/2015 to include colorized ls, Spock LLAP emoji prompt, and minor changes to overall UI – LLAP prompt requires modern version of OS X)