Tuesday, June 19, 2007

Be Prompt!

For those of us using command line often enough, the shell prompt is not only for prompting you to enter your command but also (and perhaps more importantly) displaying information back to you without you having to dig for it.

If you are using bash, there are plenty of good pages out there explaining how to customize its prompt. Below are some of my favorites:
  • Prompt Magic (from ibm.com): a good introductory text that explains not only how to use color (with a good color diagram for easy color look-up) but also, if you are using xterm-compatible terminal, how to change other things beside the prompt from within the prompt.;-)
  • Change the color of my shell prompt: another good introductory text which explains how to use the tput (to initialize a terminal) to avoid terminal-dependent colored prompts.
  • The Official HOWTO: of course if you need details there is always the excellent Bash Prompt HOWTO.
It's worth noting that most of this color stuff is done through what is know as ANSI escape code, detailed in the ECMA-48 standard. A more concise and understandable list of ANSI codes can be found at RRBrandt Services, the ANSI/VT100 Terminal Control site and ANSI Escape Sequence site.

Labels: , ,

0 Comments:

Post a Comment

<< Home

eXTReMe Tracker