bash print with color code example

Example 1: bash change output color

echo -e '\e[31m'	# The output color is now red

Reset = '\e[0m'
Bright = '\e[1m'
Dim = '\e[2m'
Underscore = '\e[4m'
Blink = '\e[5m'
Reverse = '\e[7m'
Hidden = '\e[8m'

FgBlack = '\e[30m'
FgRed = '\e[31m'
FgGreen = '\e[32m'
FgYellow = '\e[33m'
FgBlue = '\e[34m'
FgMagenta = '\e[35m'
FgCyan = '\e[36m'
FgWhite = '\e[37m'

BgBlack = '\e[40m'
BgRed = '\e[41m'
BgGreen = '\e[42m'
BgYellow = '\e[43m'
BgBlue = '\e[44m'
BgMagenta = '\e[45m'
BgCyan = '\e[46m'
BgWhite = '\e[47m'

Example 2: print colored text bash

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

Tags:

Misc Example