Use color for terminal output
Colorful
You don't necessarily need color on the terminal, but still, it does look good – and does not involve too much effort.
If you look at the output of the common Linux commands, there is always one impressive feature: simplicity. Nothing flashes, wobbles, or makes a noise – plain-vanilla information without any distracting trappings. In today's world, where every device or open tab in the web browser begs for attention with a beep, this approach, which may seem anachronistic to newcomers, supports a focused work approach and lets you fully concentrate on solving the problem at hand. Simply fantastic.
Why Color?
If everything is so perfect, why bother with color? Color helps to highlight things and draw your attention to a particular point or fact. Let's take a look at how we can spice up the output on the command line with some color. Note that how the output is actually displayed depends on the terminal, its size, the fonts used, and other settings. After all, you still want output to remain legible.
Without color, neither the developer nor the program have to worry about the properties of the terminal currently in use. Nobody needs to know how the user's terminal is set up and what output the program uses (e.g., whether it is a simple display on the terminal, a redirect to a file, or further processing via a pipe). Remember: Color increases complexity.
[...]
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
NVIDIA Released Driver for Upcoming NVIDIA 560 GPU for Linux
Not only has NVIDIA released the driver for its upcoming CPU series, it's the first release that defaults to using open-source GPU kernel modules.
-
OpenMandriva Lx 24.07 Released
If you’re into rolling release Linux distributions, OpenMandriva ROME has a new snapshot with a new kernel.
-
Kernel 6.10 Available for General Usage
Linus Torvalds has released the 6.10 kernel and it includes significant performance increases for Intel Core hybrid systems and more.
-
TUXEDO Computers Releases InfinityBook Pro 14 Gen9 Laptop
Sporting either AMD or Intel CPUs, the TUXEDO InfinityBook Pro 14 is an extremely compact, lightweight, sturdy powerhouse.
-
Google Extends Support for Linux Kernels Used for Android
Because the LTS Linux kernel releases are so important to Android, Google has decided to extend the support period beyond that offered by the kernel development team.
-
Linux Mint 22 Stable Delayed
If you're anxious about getting your hands on the stable release of Linux Mint 22, it looks as if you're going to have to wait a bit longer.
-
Nitrux 3.5.1 Available for Install
The latest version of the immutable, systemd-free distribution includes an updated kernel and NVIDIA driver.
-
Debian 12.6 Released with Plenty of Bug Fixes and Updates
The sixth update to Debian "Bookworm" is all about security mitigations and making adjustments for some "serious problems."
-
Canonical Offers 12-Year LTS for Open Source Docker Images
Canonical is expanding its LTS offering to reach beyond the DEB packages with a new distro-less Docker image.
-
Plasma Desktop 6.1 Released with Several Enhancements
If you're a fan of Plasma Desktop, you should be excited about this new point release.