Quicklinks: colors in tshark! | 24bit color
Part of the allure of Wireshark is the ability to identify networking problems
with the use of color. Relatively recently, tshark has gained this ability too
with the --color flag. This article goes over how to set it up on your system.
You can alias tshark for your terminal session with this:
alias tshark='tshark --color'`
Add this line to your .bashrc to have it permanently:
echo -e "alias tshark='tshark --color'" >> ~/.bashrc
source ~/.bashrc
Support for terminal colors depends on whether “truecolor” 24-bit colors are
implemented. One way to check for it is to query the $COLORTERM environment
variable. If supported, echo $COLORTERM will return truecolor or 24bit.
This repo keeps track whether your ${TERMINAL} supports 24bit-color as well as general 24bit-color info.
I have tested 24bit-color and tshark --color compatibility across multiple terminals.
These are my recommendations:
| Platform | Recommendations |
|---|---|
| Windows | Mobaxterm, WSL [1] |
| Macos | iTerm2, upterm |
| Linux | gnome-terminal, Any terminal using libvte |
| BSD | gnome-terminal, Any terminal using libvte |
[1]: Note that you can call Powershell from Mobaxterm or WSL, but given that Powershell does not support 24bit-color, you are limited to using bash pseudo-terminals on Windows to get 24bit-color.
As with most things terminal, Windows complicates things.
I created a hack that will allow you to use tshark --color while capturing on
Windows by using both Windows and Linux tsharks.
sudo apt install tshark~/.bashrc:source ~/.bashrctshark command with no options: