How can I get `less file` without colors?

Whenever I use less file it tries to color-code the file. Which is great unless the file is large. Is there some way to turn off color from less; to just view the file as-is, so it is lightning fast even with large files?

I’ve tried searching for “less without color”, but I only get endless hits on how to get less with color, which I kinda know already (unbuffer and/or less -R).

I have only every experienced color from less file here in NixOS, but just let me know if this is an upstream issue.

I can’t reproduce it on my nixos system. (25.05)

image

my less is /nix/store/y433bl4sfbg3pfrdhfmh88g7398rqfb1-less-668/bin/less from nixpkgs/pkgs/by-name/le/less/package.nix at 23e89b7da85c3640bbc2173fe04f4bd114342367 · NixOS/nixpkgs · GitHub

nix shell github:nixos/nixpkgs/23e89b7da85c3640bbc2173fe04f4bd114342367#less -c less #file

less on nixos uses lesspipe for preprocessing by default

https://search.nixos.org/options?channel=24.05&show=programs.less.lessopen&from=0&size=50&sort=relevance&type=packages&query=programs.less

You can set the option to null, rebuild, and reboot.

2 Likes

Exactly as waffle8946 said. I have this NixOS module for this reason:

{ ... }:

{
  programs.less.lessopen = null;
}
1 Like

You can also disable lesspipe processing for a certain invocation of less by appending a : to the file name:

less file:

1 Like