Samurai Penguin's Lair
Custom Bash Prompt 
Monday, May 12, 2008, 07:02 AM
All things have to start somewhere. Linux starts with the shell, and this blog embodies that spirit by hacking it up. This is my prompt on all my servers. It’s 3 lines, and includes all possible relevant information. Date/time, load, and memory use, and the normal user@host:path info. It’s also easily customizable. Here’s how it looks:



The comments pretty much cover how it works, with the memory working the same as the load average. It does require the ‘ansicolor’ library, which I borrowed and improved from ubuntuforums. It’s quite useful for bash programming. This makes it trivial to customize the prompt. Set the colors you want at the top under the PROMPT_COLOR variables. I’ve included two variations(one commented) in the script, so I can tell which machine I’m on at a glance.

Click here to download the code

Comments 

Add Comment

Fill out the form below to add your own comments.









Insert Special: