How to work with text colors on Linux

By Michael Cooney

How to work with text colors on Linux

Want to add color to the command line on Linux? You can create colored text in your scripts and use color settings to change the background of your screen.

When you list files on the Linux command line, many of the file names show up in colors, as you've probably noticed. The colors used depend on the file types. For example, the names of directories will show up in a blue font. Here's a list of the colors you can expect to see and what they represent:

If you'd like to get a quick confirmation on how this works, create an empty directory (e.g., mkdir TEST) and move into it with the cd command. Then run the following commands to create a sampling of the various file types:

Once you run these commands, you will see a colorful listing whenever you run the ls command. The only one of the eight file types mentioned in the bullet list above that will not be set up will be the device file. Run the command "ls /dev/null" to see an example of the colors used for displaying devices.

Previous articleNext article

POPULAR CATEGORY

corporate

9532

tech

10467

entertainment

11746

research

5126

misc

12303

wellness

9248

athletics

12358