commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
Add this to a fiend's .bashrc.
PROMPT_COMMAND will run just before a prompt is drawn.
RANDOM will be between 0 and 32768; in this case, it'll run about 1/10th of the time.
\033 is the escape character. I'll call it \e for short.
\e7 -- save cursor position.
\e[%d;%dH -- move cursor to absolute position
\e[4%dm \e[m -- draw a random color at that point
\e8 -- restore position.