Skip to content

A patch to add colors to the strace output

Notifications You must be signed in to change notification settings

xfgusta/strace-with-colors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 

Repository files navigation

strace, but with colors

This patch adds colored output to the strace program.

The --color option

From strace --help

  --color[=WHEN]
                 colorize the output; WHEN can be 'always', 'auto' (default), or 'never'
  • always will always colorize the output
  • never will never colorize the output
  • auto will only colorize the output when standard output is connected to a terminal

Using --output or setting the NO_COLOR environment variable will disable the colored output.

Installation

Arch Linux

strace-with-colors package from AUR

git clone https://aur.archlinux.org/strace-with-colors.git
cd strace-with-colors
makepkg -si

Fedora Linux

strace-with-colors package from Copr

dnf copr enable xfgusta/strace-with-colors
dnf install strace-with-colors

From source

Clone the strace git repository and go to the directory

git clone https://github.com/strace/strace
cd strace

Checkout the tag v6.3 (latest version)

git checkout tags/v6.3

Get the patch source here and apply it

curl -O https://raw.githubusercontent.com/xfgusta/strace-with-colors/main/strace-with-colors.patch
git apply strace-with-colors.patch

Now you are ready to build and install strace with colors!

./bootstrap
./configure --enable-mpers=no
make install

You may need to install some dependencies before, like:

  • make
  • autoconf
  • automake
  • gcc
  • ...

You can actually check all the strace installation instructions here.

The program will be in the /usr/local/bin directory. You can uninstall it running make uninstall.

Screenshot

Color scheme

Here is the color scheme used in the screenshot above:

FG Name Color
0 Black #2d3139
1 Red #e06c75
2 Green #98c379
3 Yellow #e5c07b
4 Blue #528bff
5 Magenta #c678dd
6 Cyan #56b6c2
7 White #d7dae0