Coloring Linux Standart System

Last Updated on November 10, 2022 by Humera Hallari

If you want to coloring Linux terminal that using standart system, you can do with the following knowledge.

 Style        Foreground     Background
-----------------------------------------
 NORMAL=0     FG_BLACK=30    BG_BLACK=40
 BOLD=1       FG_RED=31      BG_RED=41
 UNDERLINE=4  FG_GREEN=32    BG_GREEN=42
 BLINK=5      FG_YELLOW=33   BG_YELLOW=43
 REVERSE=7    FG_BLUE=34     BG_BLUE=44
              FG_MAGENTA=35  BG_MAGENTA=45
              FG_CYAN=36     BG_CYAN=46
              FG_GRAY=37     BG_GRAY=47
              FG_DEFAULT=39  BG_DEFAULT=49
NOTE: Not specifying a style, foreground, or background code in the
escape sequence is the same as entering the normal or default value.
b   Insert the baudrate of the current line.
d   Insert the current date.
s   Insert the system name, the name of the operating system.
l   Insert the name of the current tty line.
m   Insert the architecture identifier of the machine, e.g., i686.
n   Insert the nodename of the machine, also known as the hostname.
o   Insert the domainname of the machine.
r   Insert the release number of the kernel, e.g., 2.6.11.12.
t   Insert the current time.
u   Insert the number of current users logged in.
U   Insert the string "1 user" or "<n> users" where <n> is the
    number of current users logged in.
v   Insert the version of the OS, e.g., the build-date etc.

Example to change the text color (foreground) to bold blue…
^[[1;34m

Example to change the text color to normal blue and change the background to cyan…
^[[0;34;46m

Example to revert back to the default style, text, and background…
^[[0m

This example of direct command using syntax

# echo -e '\e[1;31mUbuntu\e[0m' > /etc/issue

Leave a Comment