I am looking for a way to get a list of all the upgradable packages for Debian and RHEL distros. I know that dpkg stores some data in /var/lib/dpkg/status, but I have found nothing there indicating that a given package has a new version available for update.

I guess that since apt list --upgradable lists all the available upgrades very fast, it must rely on some cache: is it available as a file somewhere?

I have no clue about the same thing with RHEL: dnf seems to have a cache in /var/cache/dnf, but it is mostly binary files.

  • strace apt list --upgradable will print you all system calls (so mainly the file that are opened or read). For Debian, it seems /var/lib/apt/extended_states is the file which it is parsed. In any case, you should use the libraries (which are provided for various languages) and not directly reading the internal files, if you are not following closely the development of internal work in distributions. May 16, 2023 at 14:59

2 Answers 2


apt and dnf don’t store a list of upgradable packages, they calculate it whenever they’re asked. They do this by comparing installed packages’ versions with the versions available in the repositories they’re configured with; the latter information is cached (e.g. in /var/lib/apt/lists for apt).

  • 1
    That means the easiest way to get the list would be to run apt and dnf from a script and work with their output, I guess. Thanks ! May 16, 2023 at 15:18

For RHEL, you can run the command

dnf check-update

Without arguments, it checks for available updates on all packages, and prints the names of the packages that can be updated.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .