Add some FUN to your CLI with GRC

Cloud Jake
2 min readApr 28, 2021
screenshot of the DIG command colorised with GRC

Admittedly, I am way too excited about stumbling upon this tool while researching another project. As I’ve gotten along in may career, I find myself at the CLI less and less. So, when I do have the opportunity to roll up my sleeves and get access to the CLI, I like to have some fun at the same time ;)

Objective

Install and configure the GRC (Generic Colouriser) to add a little color to existing CLI commands.

Installation

GRC is available via GitHub as well as packaged for many LINUX distributions. In the case of Ubuntu or Debian and derivatives, installing is as simple as using in the APT package manager:

# apt-get install grc

GRC is also available for Mac OS via Homebrew:

% brew install grc

Usage

GRC consists of 2 main tools:

  • grcat — the main command
  • grc — acts as frontend for grcat

The main command is grcat, which acts as a filter, i.e. taking standard input, colorizing it, and writing to standard output. grc will execute the specified command with optional parameters piping its stdout into grcat.

By default, grc will be installed with a number of configurations for many popular commands. While the number of configurations will vary amongst packages for different distributions, the following configurations are delivered in the default installation via Homebrew for Mac OS:

ant
blkid
configure
cvs
df
diff
dig
dnf
docker-machinels
dockerimages
dockerinfo
dockernetwork
dockerps
dockersearch
dockerversion
du
env
fdisk
findmnt
free
gcc
getfacl
getsebool
go-test
id
ifconfig
iostat_sar
ip
ipaddr
ipneighbor
iproute
iptables
irclog
iwconfig
kubectl
last
ldap
log
lolcat
ls
lsattr
lsblk
lsmod
lsof
lspci
mount
mtr
mvn
netstat
nmap
ntpdate
ping
ps
semanageboolean
semanagefcontext
semanageuser
sensors
showmount
sockstat
ss
stat
sysctl
systemctl
tcpdump
traceroute
tune2fs
ulimit
uptime
vmstat
wdiff
whois

Basic

You can get started immediately by prepending any of the above commands with grc. For example:

% grc traceroute -n google.com
screenshot of traceroute to google.com with color by adding grc command

Advanced

Beyond manually prepending the commands listed above with grc, you can additionally configure your shell with some of the pre-delivered env scripts. The grc README file explains how to do this in detail — including how to add custom configurations for additional commands.

Conclusion

The GRC command is a fun way to add some color to existing CLI tools. Enjoy!

--

--