On 05/05/2026 6:26 pm, Greg Wooledge wrote:
     apt list '?installed ?section(contrib)'

Here's what it gives me:

hobbit:~$ apt list '?installed ?section(contrib)'
ESC[32msteam-installerESC[0m/stable,now 1:1.0.0.83~ds-3 amd64 [installed]

Sadly, someone decided that it should automatically pipe through
less when stdout is connected to a terminal, and my $LESS settings
don't include -R by default, so I get terminal escape sequence
gibberish.

You may export APT_PAGER. I do not need to deal with terminal escape characters, but I do not like trimming long lines:

        # - "i" to ignore case search like in man(1).
        # - "+S" to disable trimming of long lines and so
        #   hiding full list of dependencies for "apt show".
        APT_PAGER="less -i -+S --wordwrap"
        export APT_PAGER

Unfortunately there are some differences in comparison to SYSTEMD_PAGER behavior.

You may consider the following alternatives:

    Binary::apt::Pager "false";
    Binary::apt::APT::Color "false";

One can try to circumvent that, but it starts getting uglier:

hobbit:~$ apt list '?installed ?section(contrib)' | cat

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

<https://lists.debian.org/msgid-search/[email protected]>
Julian Andres Klode. apt_3.3.0_source.changes ACCEPTED into unstable. Fri, 01 May 2026 17:36:55 +0000

   [ Julian Andres Klode ]
   * Drop warning about unstable CLI interface.
     A specific CLI version can now be requested using the --cli-version
     flag, and old versions can be deprecated on a reasonable cadence.
     Therefore, a warning is no longer necessary.

Reply via email to