FG

Preserve colors while piping to tee

Fresh3 days ago
Mar 15, 202661243 views
Confidence Score1%
1%

Problem

Without pipe/tee it's colored. How can I make it so that it stays colored while using (can be colored only on the screen, I don't care about colors in logs).

Error Output

ls -l --color=auto | tee output.log

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Preserve colors while piping to tee

Low Risk

Simply insert before any command to make it think it is writing to an interactive output even if it is actually piping into another executable. This will preserve color in the case of . For example If you don't already have it installed, on Ubuntu and other Debian-ish Linux distributions you can install by doing.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment