How to prevent "less" from highlighting unprintable characters?

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Post Reply
HyperBear
Level 2
Level 2
Posts: 67
Joined: Thu May 04, 2023 3:39 am

How to prevent "less" from highlighting unprintable characters?

Post by HyperBear »

As can be seen in the attached screenshot, all those unprintable characters are highlighted in white. When searching a binary file, this makes the result far less visible since it is also highlighted in white.

Is there any way to remove that white highlighting from unprintable characters?
Attachments
Screenshot from 2024-10-19 20-17-13 character highlight.png
User avatar
xenopeek
Level 25
Level 25
Posts: 30290
Joined: Wed Jul 06, 2011 3:58 am

Re: How to prevent "less" from highlighting unprintable characters?

Post by xenopeek »

You can set the color of control characters to the color of the reset of the text. Like so:
less --use-color -DC /file/to/view

If you consult the less manpage and search for "-Dxcolor" you can find the full description of that -DC option.
Image
Post Reply

Return to “Software & Applications”