Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 05-31-2012, 12:12 PM   #1
LQ Newbie
Registered: May 2012
Posts: 1

Rep: Reputation: Disabled
change command line color

How can I change the font color of the command line?
Old 05-31-2012, 12:52 PM   #2
LQ Newbie
Registered: Apr 2010
Location: Chesapeake Virginia
Distribution: Slackware
Posts: 7
Blog Entries: 2

Rep: Reputation: 0
Add colors to the prompt
To add colors to the shell prompt use the following export command syntax:
'\e[x;ym $PS1 \e[m'


\e[ Start color scheme
x;y Color pair to use (x;y)
$PS1 is your shell prompt
\e[m Stop color scheme
To set a red color prompt, type the command:
$ export PS1="\e[0;31m[\u@\h \W]\$ \e[m "

List of Color code
Color Code
Black 0;30
Blue 0;34
Green 0;32
Cyan 0;36
Red 0;31
Purple 0;35
Brown 0;33
Blue 0;34
Green 0;32
Cyan 0;36
Red 0;31
Purple 0;35
Brown 0;33
Replace digit 0 with 1 to get light color version.

Be careful! Goofing the escape codes can have very nasty or unpredictable result.
Old 05-31-2012, 01:02 PM   #3
Registered: Sep 2011
Location: Trinidad & Tobago
Distribution: Debian Stretch
Posts: 612

Rep: Reputation: 125Reputation: 125
If you're using BASH, open your ~/.bashrc file and look for the following lines:
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
Uncomment the last line:
This will give you a colored prompt.

To change the default colors edit this line:
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
Use the codes from the previous poster.

You can set the default colors for the ls commands with the dircolors command. Other commands such as find have their own color options.

Hope this helps.
Old 05-31-2012, 01:09 PM   #4
Registered: Jul 2010
Location: oregon usa
Distribution: Slackware 14.1, Arch, Lubuntu 18.04 OpenSUSE Leap 15.x
Posts: 518

Rep: Reputation: 24
Originally Posted by fatherwillow View Post
How can I change the font color of the command line?
The first two answers relate to changing the color of your prompt, but not necessarily that of the text printed in the terminal. For that I googled <linux command line text color> and this is the first result
Old 05-31-2012, 01:13 PM   #5
Senior Member
Registered: Apr 2005
Location: OZ
Distribution: Debian Sid/RPIOS
Posts: 4,865
Blog Entries: 28

Rep: Reputation: 530Reputation: 530Reputation: 530Reputation: 530Reputation: 530Reputation: 530
Old 06-01-2012, 06:27 AM   #6
David the H.
Bash Guru
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
Rather than playing guessing games, it would be better to hold back a bit and wait for the OP to clarify what he means.

As you can see, a simple one-line question that can be interpreted several ways is not a good question. If you want to get good, clear answers quickly, describe what you want in some detail, along with other possibly-relevant details about your environment, such as your distro, shell, and the console program you use to run it in (if any).

Please read How To Ask Questions The Smart Way, and try again.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
help! bash command prompt font/color change richiangpan9 Linux - Newbie 3 04-24-2005 11:34 AM
What is the command to change text color? BiO|Happy Mandriva 2 06-09-2004 02:54 PM
Changing color of command line interface JustinCoyan Slackware 1 05-28-2004 11:35 AM
ls command line, color and wildcards ioio85 Linux - Newbie 1 05-13-2004 05:01 AM
need to know system command to change text color Mr_ss Linux - General 2 06-22-2001 10:13 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:29 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration