---
title: "How to change the output color of echo in Linux"  
description: "How to change the output color of echo in Linux"  
author: "Utpal Vishwas"  
published: 2023-07-14  
updated: 2023-07-15  
canonical: https://www.mindstick.com/forum/159084/how-to-change-the-output-color-of-echo-in-linux  
category: "linux"  
tags: ["linux", "colors", "linux gui"]  
reading_time: 2 minutes  

---

# How to change the output color of echo in Linux

How to change the [output](https://www.mindstick.com/interview/34427/explain-the-output-in-angular) [color](https://www.mindstick.com/articles/77/how-to-split-form-background-color-in-c-sharp) of [echo](https://www.mindstick.com/articles/23392/be-a-21st-century-shopper-and-use-your-amazon-echo-for-holiday-shopping) in [Linux](https://www.mindstick.com/blog/11489/linux-os)

## Replies

### Reply by Aryan Kumar

Sure, there are a few ways to change the output color of echo in Linux. Here are two methods:

**Method 1: Using the** `ANSI escape codes`

The ANSI escape codes are a set of codes that can be used to control the appearance of text on a terminal. To change the output color of echo using ANSI escape codes, you can use the following syntax:

```plaintext
echo -e "<escape_code> <text>"
```

For example, to change the output color of echo to red, you would use the following code:

```plaintext
echo -e "\033[31mHello, world!\033[0m"
```

The `\033[31m` escape code tells the terminal to set the text color to red.

The `\033[0m` escape code tells the terminal to reset the text color to the default.

**Method 2: Using the** `colorama` **module**

The `colorama` module is a Python module that can be used to add color to text in the terminal. To change the output color of echo using the `colorama` module, you can use the following code:

```plaintext
import colorama

colorama.init()

print(colorama.Fore.RED + "Hello, world!" + colorama.Fore.RESET)
```

The `colorama.Fore` module provides a number of constants that can be used to set the text color.

The `colorama.init()` function initializes the `colorama` module.


---

Original Source: https://www.mindstick.com/forum/159084/how-to-change-the-output-color-of-echo-in-linux

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
