ASCII Escapes For Bash

From Nearline Storage
Revision as of 17:50, 31 August 2013 by Dlk (talk | contribs) (Created page with "Stolen from http://hacktux.com/bash/colors Bash Color Escape Codes Echo (echo -e) the following escape codes inside \e[ESCCODEm to colorize text in Bash: {| style="margin-l...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Jump to navigation Jump to search

Stolen from http://hacktux.com/bash/colors

Bash Color Escape Codes

Echo (echo -e) the following escape codes inside \e[ESCCODEm to colorize text in Bash:

Black 0;30
Dark Gray 1;30
Blue 0;34
Light Blue 1;34
Green 0;32
Light Green 1;32
Cyan 0;36
Light Cyan 1;36
Red 0;31
Light Red 1;31
Purple 0;35
Light Purple 1;35
Brown 0;33
Yellow 1;33
Light Gray 0;37
White 1;37

Make sure to use echo -e to enable interpretation of backslash escapes:

bash$ echo -e "This is red->\e[00;31mRED\e[00m"

Remove Color

Echo \e[00m to remove text color modifications:

bash$ echo -n '\e[00m'