Skip to content

How to change Background Color of Text in Linux Shell

Bash Change text background color. Change Background color of text in Linux Shell outputs. Show background in different color in command line output.

Command:

echo -e “\\e[0;41mBackground in Red Color\\e[0m”

The Above commands are using to set background color of output on Linux bash shell. In The output of above command background will be in red color. There are many other colors available which you can use defined as below. Just replace “0;41” with other color values in above text.

Other Color Codes’s:

   Black        0;40
   Red          0;41
   Green        0;42
   Yellow       0;43
   Blue         0;44
   Purple       0;45
   Cyan         0;46
   White        0;47

The 0m is used to reset the settings.

Background color of text in linux

Rahul

Rahul Kumar is the founder and chief editor of TecAdmin.net. A Red Hat Certified Engineer (RHCE), he has worked in IT since 2009, with hands-on experience in Linux system administration, DevOps, web hosting, cloud platforms and automation. He started TecAdmin in 2013 to share practical, step-by-step guides, and leads its editorial work with one aim: making technical learning clear and useful for sysadmins, developers and beginners alike.

3 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *


Back to top