is there a way to just print list of packages available for upgrade ?
I am using pacman (yay) of arch linux.
Thank you for help
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
pacman-contrib includes a script that can list all the pending updates without applying them, called
checkupdates. pacman-contrib is in the community repository
checkupdates - print a list of pending updates without touching the system sync databases (for safety on rolling release distributions).
First you need to update your local package repository databases:
sudo pacman -Sy or
pacman -Sy as root.
Pacman then fetches the most recent database from your configured mirrors. (This is not an upgrade, this is just updating the list of available package versions)
Then use this command to list upgradable packages:
This command compares the installed versions of packages to the available ones in your local package repository databases. If you skip step one (above), this will likely produce an empty list.
Same applies to yay:
yay -Sy; yay -Qu.
Important Note: Arch does not support partial upgrades and running
pacman -Sy sets up for exactly that. See Arch Wiki for reference.
If you use this way to check for upgradable packages make sure you always install using
pacman -Su $package.
Since it can happen that the package version in your local database does not exist on the mirror anymore I recommend to always upgrade the system when installing a new package anyways.
So at the end its a tradeoff and choice of workflow in my opinion. The alternative of course is the solution mentioned by Alex which includes an extra package to achieve what you asked for, but without updating the systems package database.
Pacman is one of the best package managers out there (in my opinion) and as most of the time the Arch Linux Wiki is a great source of information: Arch Wiki