Spotlight | Reviews | Current Issue | Newsletter | Subscribe | Contact |
Departments

user friendly

  linux-magazine.com » Issues » 2007 » 83 » PAINT YOUR BASH  

Print this page. Recommend
Slashdot it! Delicious Digg

ANSI escape sequences

PAINT YOUR BASH

Author(s): HEIKE JURZIK

This month, we’ll show you how to decorate your console and give it a fresh new look by adding color to the command line with ANSI escape sequences.

Black on white, or white on black – a terminal doesn’t need to be so boring. Any modern Linux console can display colors to brighten up program output, welcome messages, and even the shell prompt. This article shows you how to add a touch of color and decorate your command line.

The Color Palette

Some programs have their own parameters for adding color to output. Both ls and grep support a --color option that makes command output easier to read (Figure 1). ANSI escape sequences provide the underlying mechanism for this. To get a line of colored output with echo in Bash, you can add an escape sequence to the text (Listing 1).


Read full article as PDF »


Comments


Print this page. Recommend
Slashdot it! Delicious Digg
Related Articles
SHELL GAMES Comparing Bash with the Windows Vista shell
SCRIPT WORKOUT Script tuning in Bash
SCRIPTING SECRETS New tools and techniques for scripting in Linux
PRIMPED PROMPT Configuring the Bash prompt
Special Linux Magazine 3 for 1 Offer

Get 3 Issues + 3 DVDs for the price of a single issue!

Let Linux Magazine's hands-on, technical articles guide you in your daily Linux use. Check out bonus DVDs like Ubuntu, SUSE, or Fedora and save the download.

Only available for a limited time. Don't miss out!

more...

 

In the US and Canada, Linux Magazine is known as Linux Pro Magazine.
Entire contents © 2008 [Linux New Media USA, LLC]
Linux New Media web sites:
North America: [Linux Pro Magazine]
UK/Worldwide: [Linux Magazine]
Germany: [Linux-Magazin] [LinuxUser] [EasyLinux] [Linux-Community] [Linux-Nachrichten] [Linux Events]
Eastern Europe: [Linux Magazine Poland] [Linux Community Poland] [Darmowe Programy Poland] [Open Source DVD Poland] [Linux Magazin Romania]
International: [Linux Magazine Brazil] [Linux Magazine Spanish]
Corporate: [Linux New Media AG]