Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can any one please help me understand this code snippet that I found in .profile file

echo -en "\e[32;44m $(hostname) \e[m";echo -e "\e[m"
share|improve this question
up vote 10 down vote accepted

This snippet is used to print out the hostname of the system with a blue background and a green font.

To color your shell, you use special color escape sequences.

\e[ starts the color scheme, 32; will set the foreground color to green, 44 will set the background color to blue and m will end it.

$(command) creates a new shell, executes command and returns the result (not the return value).

hostname returns the hostname of the current system.

\e[m will reset the coloring of the output.

From the echo manpage:

   -n     do not output the trailing newline
   -e     enable interpretation of backslash escapes

IMHO your snippet could be simplified to echo -e "\e[32;44m $(hostname) \e[m";

See the chapter 6.1 Colours of the BASH Prompt HOWTO for more details.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.