Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

console tool that displays files highlighting some patterns with colors

Project description

colorex is a powerful console tool that displays files highlighting some patterns with colors
Copyright (C) 2011

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see

if you haven't setuptools installed you can just copy the "colorex" script into your path (eg: /usr/local/bin)
don't forget to check that colorex is executable.

python install

colorex [options] [file1] [file2] ...

Display files or sdtin with pretty colors for matched patterns. if you don't specify
files, stdin is used.

--version show program's version number and exit
--help, -h show this help message and exit
--blue=BLUE, -b BLUE display BLUE pattern in blue
--red=RED, -r RED display RED pattern in red
--green=GREEN, -g GREEN display GREEN pattern in green
--yellow=YELLOW, -y YELLOW display YELLOW pattern in yellow
--magenta=MAGENTA, -m MAGENTA display MAGENTA pattern in magenta
--cyan=CYAN, -c CYAN display CYAN pattern in cyan
--bblue=BBLUE, -B BBLUE display BBLUE pattern in blue background
--bred=BRED, -R BRED display BRED pattern in red background
--bgreen=BGREEN, -G BGREEN display BGREEN pattern in green background
--byellow=BYELLOW, -Y BYELLOW display BYELLOW pattern in yellow background
--bmagenta=BMAGENTA, -M BMAGENTA display BMAGENTA pattern in magenta background
--bcyan=BCYAN, -C BCYAN display BCYAN pattern in cyan background
--blink=BLINK, -K BLINK display BLINK pattern blinking (not widely supported)
--bold=BOLD, -D BOLD display BOLD pattern in bold
--undrln=UNDRLN, -u UNDRLN display UNDRLN pattern underlined
--bisounours, -N display with random colors

Regular expressions are interpreted, so if you want to match a '*' or a '[' or any element of the regexp grammar
you have to escape it with a backslash.

to display every word "ERROR" in red of foo.txt, type:
colorex --red ERROR foo.txt

to watch logfile.txt displaying "WARNING" in yellow and "INFO" in green:
tail -f logfile.txt | colorex -y WARNING --green INFO
exit with CTRL c

to display "(" and ")" contained in foo.txt in blue:
colorex -b '\(|\)' foo.txt

to diplay in red "FATAL" or "ERROR" and strings like [1234] or [4567] with red background, just type:
colorex -r 'ERROR|FATAL' -R '\[[0-9]{4}\]'

another case:
tail -f /var/log/syslog | colorex -G '[0-9]{2}:[0-9]{2}:[0-9]{2}' -b $(hostname) -M '\[[0-9]{1,5}\]' -y root

Project details

Release history Release notifications | RSS feed

This version


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for colorex, version 2.0
Filename, size File type Python version Upload date Hashes
Filename, size colorex-2.0.tar.gz (4.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page