What is the color code for line in the ubuntu terminal?

What is the color code for line in the ubuntu terminal? Some words are blue and some words are green. What does it mean? (The rhyme just happened. It was as though something was flowing through me.)

There are colors in the ubuntu terminal??

Is this what you’re referring to :

i.e. different colours of files in the output of the “ls” command?

I don’t believe this is specific to Ubuntu…

This red output indicates a broken symlink (symbolic link i.e. it’s pointing to something that doesn’t exist or not located there)

Blue usually means a folder :

And I can’t remember what this means (I’m colour blind - but I think that’s highlighted background in green) :
image

2 Likes

I think @daniel.m.tripp has answered it for ls, but I can add a few things

The colors in the command line prompt are set in ~/.bashrc
If you look in that file you will see things like

\[\033[01;32m\]

The \033 is the ESC character ( ascii escape) in octal notation.
it signals to bash that what follows is an escape sequence controlling color
the 32m means green
You will also see 00m meaning no color
and 01;34m meaning blue

You can edit .bashrc and change these colors if you wish.
Look at man bash to learn about bash settings
If you su to root, the colors will change. Root has its own .bashrc file.

man dircolors will give you a description of how the colors are set in ls

Colors do tend to be overdone, particularly in editors… so many things colored you cant see where the cursor is. Many people disable colors in editors like vi, for this reason.

It’s not just Ubuntu but shared across all Debian based Linux command line editor

But an interesting question, use it a good bit but never thought why just accepted it

1 Like

Thanks, Neville very helpful.

1 Like

I’m new to Linux. People say basic tutorials. They don’t know how basic I need. I’m pre-basic. Thanks for your reply.

1 Like

Thanks, Dan. Those are the colors I was referring to. The opening line in my terminal is green. The dash is blue, and the dollar sign is in white. I didn’t know if the colors were universal and had a particular meaning, or at the creator’s discretion.

Best bet is start with a easy to use Linux such as mint, stay with the graphical screens and windows till you feel comfortable and don’t worry too much about command lines, most tasks can be carried out on the graphical side.
But if stuck then post a question here but do try to explain as much as you can and where you want to go. The other technicians on this site are a great team with loads of experience and knowledge. There is no such thing as a stupid question we have all been there and tried to do that and learn on route.
If you do a Google search there are many course on learning Linux some are free and the itsfoss web site has several really good learning guides but some may not be suitable depending on the level.
Welcome to the never ending learning curve which we are all on.
Every day I get something new from the site and the newsletters and I have been in computing for over 40 years and using Linux for around 18 still learning.

2 Likes

I use to do that - I kinda hated syntax highlighting - and it was horrible in things like PuTTY when I used MS Windows to manage NIX / Linux stuff.

But - I can’t stand not having it now! I sometimes have to tweak my terminal settings… But I can mostly manage it. And on some systems, I end up installing vim just to get things like syntax highlighting (i.e. to replace vi / vimtiny or whatever it’s called, on things like Oracle Linux 7 and earlier).

These days I now hate editing bash scripts or YAML without colours.

I think it’s WAY too early in @grundoon13’s Linux journey to start talking about shell escape sequences, and .bashrc (which is confusing even to me, a 25+ year veteran - because there’s often also .bash_profile! Which one??? could be one of the reasons I switched to ZSH, as there’s ONLY .zshrc) and if @grundoon13 is using Ubuntu - STICK WITH Ubuntu - don’t try switching to Mint (or any other distro) until you’re 100% comfortable with what you’re doing in Ubuntu :smiley: safe travels and happy adventuring!

1 Like

It’s Foss is a go to for me. Used it many times, and try to follow their tutorials. Though, I’m new to it, I’m liking Linux and Ubuntu. Thanks for your encouragement.

1 Like

I agree.
I just wanted to show him that the colors are not fixed… they are just some choice that Ubuntu made, and can be changed

1 Like

I will say one thing - I kinda HATE “red on black” text, ever since high school, some teacher would write in red chalk on the blackboard - and being red-green colour-blind, I couldn’t read it…

But I now have my terminal tweaked just at the right balance between black background, transparency (or sometimes AKA “opacity”) and font size (I usually have terminal fonts at 14pt - de rigeur for me, with QHD 32" monitors) that I can read red text on black background, but even so - it still kind hurts my eyes like this :


It’s kinda fuzzy to my vision… and sorta “glowy”…

I believe you are talking about different kinds of files, directories and links being displayed in different colors in the terminal.

Directories (folders) are blue, executable files are green, links are red (perhaps) and so on.

However, this is not a set standard.

Different terminal applications (called terminal emulators) have different color coding. And you can change the color profile. Hence, depending on the color code for identifying the type of file is not advisable.

They should be used to get the indication that some elements are different from the usual files.

Though your doubt has been cleared, we could quickly cover this topic for others :slight_smile:

4 Likes

Here’s what I found : a google search on terminal colours (or colors :smiley: ), most of the results returned are “how to change colors” - not what they mean or represent…

1 Like

Did you notice in Gentoo. If you su to root, the prompt goes red.
That is a good signal

2 Likes

That would be useful.
Just defining the ls colors would be simple
The dircolors man page seems to be the defining reference, but it is technical