how to list all upgradable packages without using apt [duplicate]
Ubuntu prints out: To see these additional updates run: apt list --upgradable
So I try
$ apt list --upgradable > list.txt
, to redirect to a file, but it complains:
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
So I replace apt
with apt-get
$ apt-get list --upgradable > list.txt
But I get the error:
E: Command line option --upgradable is not understood in combination with the other options
SO what command should I use to place the upgradable list in a file?
EDIT My Ubuntu version is Ubuntu 20.04.2 LTS
At least in Ubuntu 18.04 it's
apt-get --just-print upgrade
which gives, for example
me@mypc:~$ apt-get --just-print upgrade
NOTE: This is only a simulation!
apt-get needs root privileges for real execution.
Keep also in mind that locking is deactivated,
so don't depend on the relevance to the real current situation!
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
linux-generic-hwe-18.04 linux-headers-generic-hwe-18.04 linux-image-generic-hwe-18.04
The following packages will be upgraded:
google-chrome-stable libnss-systemd libpam-systemd libsystemd0 libudev1 linux-libc-dev systemd
systemd-sysv udev
9 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
Inst libnss-systemd [237-3ubuntu10.45] (237-3ubuntu10.46 Ubuntu:18.04/bionic-updates [amd64]) []
Inst libsystemd0 [237-3ubuntu10.45] (237-3ubuntu10.46 Ubuntu:18.04/bionic-updates [amd64]) [systemd:amd64 ]
Conf libsystemd0 (237-3ubuntu10.46 Ubuntu:18.04/bionic-updates [amd64]) [systemd:amd64 ]
Inst libpam-systemd [237-3ubuntu10.45] (237-3ubuntu10.46 Ubuntu:18.04/bionic-updates [amd64]) [systemd:amd64 ]
Inst systemd [237-3ubuntu10.45] (237-3ubuntu10.46 Ubuntu:18.04/bionic-updates [amd64])
Inst udev [237-3ubuntu10.45] (237-3ubuntu10.46 Ubuntu:18.04/bionic-updates [amd64]) []
Inst libudev1 [237-3ubuntu10.45] (237-3ubuntu10.46 Ubuntu:18.04/bionic-updates [amd64])
Conf libudev1 (237-3ubuntu10.46 Ubuntu:18.04/bionic-updates [amd64])
Conf systemd (237-3ubuntu10.46 Ubuntu:18.04/bionic-updates [amd64])
Inst systemd-sysv [237-3ubuntu10.45] (237-3ubuntu10.46 Ubuntu:18.04/bionic-updates [amd64])
Inst google-chrome-stable [89.0.4389.128-1] (90.0.4430.72-1 Google:1.0/stable [amd64])
Inst linux-libc-dev [4.15.0-141.145] (4.15.0-142.146 Ubuntu:18.04/bionic-updates, Ubuntu:18.04/bionic-security [amd64])
Conf libnss-systemd (237-3ubuntu10.46 Ubuntu:18.04/bionic-updates [amd64])
Conf libpam-systemd (237-3ubuntu10.46 Ubuntu:18.04/bionic-updates [amd64])
Conf udev (237-3ubuntu10.46 Ubuntu:18.04/bionic-updates [amd64])
Conf systemd-sysv (237-3ubuntu10.46 Ubuntu:18.04/bionic-updates [amd64])
Conf google-chrome-stable (90.0.4430.72-1 Google:1.0/stable [amd64])
Conf linux-libc-dev (4.15.0-142.146 Ubuntu:18.04/bionic-updates, Ubuntu:18.04/bionic-security [amd64])
If you use sudo
some of the warnings go away.