Pager used by APT CLI

Ubuntu Version:

25.04

Desktop Environment (if applicable):

Problem Description:

I would like to know what is the pager that APT command uses by default and where is it’s configurations? I execute apt show nvidia-driver-570 and I get a different configuration for less than less /var/log/auth.log. The most notable case is: when I’m using APT, I can’t scroll, but calling less directly I can.

Relevant System Information:

||/ Name           Version      Architecture Description
+++-==============-============-============-=================================
ii  apt            2.9.34       amd64        commandline package manager
ii  less           643-1        amd64        pager program similar to more

What I’ve Tried:

I try executing env LESS=-r apt show nvidia-driver-570 to set the configuration of less on apt, but didn’t work.

apt show nvidia-driver-570 will show you more if you continue to press Enter and scrolls down.
Or if you more interested in the complete return, then something like this might help.

 apt show nvidia-driver-570 >driver.txt

That wil print a complete .txt file in the same directory as the terminal location.

Hope that helps. :slight_smile:

Sorry, it didn’t. I know I can press enter, up and down keys (so I think it uses less with a different configuration), and I know I can redirect the output and even use less to read the file, but what I want is to know where apt gets the configuration for less. I have the env variable LESS that I think it should be respected. apt changelog works, but just because first it downloads the changelog file to a temporary directory and then calls the less to this file, what doesn’t happen when using apt show. I can read all the output, but I would like to use things like scroll because some times there a lot of versions of a single package.

Does this work as a workaround? -

apt show nvidia-driver-570 | less

It works. For some reason, APT doesn’t respect the configurations for the pager, in this case less, that are in LESS env variable. I found that is a variable called PAGER_ENV defined in the file CMakeLists.txt that is located in the APT’s source code. I don’t know if this env variable is just for compilation and tests or is eternal, also used during the normal run of the tool.
I don’t want to change it and recompile that because it’s a little off my area of expertise.
But I think for some reason APT didn’t allow less to use the configurations I set with the env variable. sensible-pager and pager works as should, just apt show that doesn’t work.

Just to let you know, I opened a bug report and it’s already triaged and defined as valid. It will be fixed soon. Here is the link for it: Bug #2103921 “APT doesn't respect pager's configuration with apt...” : Bugs : apt package : Ubuntu

Moved to Pre-Release Discussion. We do not support pre-release versions, but discussion about it can happen here.

FYI, this was resolved on apt 2.9.35 that just arrived on Ubuntu.