Note that “yum check-update” or “yum list updates” won’t tell you how many packages would be installed with “yum update”… dependencies and such are not resolved for check-update/list updates.
You might want to increase 1000 if you expect to have more than that number of updates :)
otoh, its pretty rare that an update has a new dependency… if the package is installed, its existing dependencies are also installed, and if they have updates, check-update would show them all, would it not?
Once upon a time, John Pierce said:
It’s not as rare as you might think, especially at point-release time. There are often new dependencies when packages get updates beyond just bug patching, sometimes an installed package might get obsoleted by a different package (can’t remember if that shows up in check-update), etc.
maybe
yum -q check-update | wc -l
Nice one, -q However that command will still count an empty line that yum outputs, even with -q; it could also create problems due to stderr. I’d use something like:
yum -q check-update 2>/dev/null|grep -c -v ^$
Chris Adams wrote:
Ok, you want it all, fine:
echo “n” | yum update | egrep “Install|Upgrade”
10 thoughts on - How To Find Out The Number Of Updates For A System
Ralf Prengel wrote:
yum check-update, perhaps?
mark
Hey Mark,
one quick and dirty possibility:
a=`yum check-updates | awk ‘{ print $2 }’ |grep -v “:” |grep -v mirror |wc
-l` ; echo $(($a – 1))
Best regards
Steffen
yum check-updates 2>/dev/null|grep -A1000 “^$”|grep -vc “^$”
Once upon a time, mark said:
Note that “yum check-update” or “yum list updates” won’t tell you how many packages would be installed with “yum update”… dependencies and such are not resolved for check-update/list updates.
You might want to increase 1000 if you expect to have more than that number of updates :)
otoh, its pretty rare that an update has a new dependency… if the package is installed, its existing dependencies are also installed, and if they have updates, check-update would show them all, would it not?
Once upon a time, John Pierce said:
It’s not as rare as you might think, especially at point-release time. There are often new dependencies when packages get updates beyond just bug patching, sometimes an installed package might get obsoleted by a different package (can’t remember if that shows up in check-update), etc.
maybe
yum -q check-update | wc -l
Nice one, -q However that command will still count an empty line that yum outputs, even with -q; it could also create problems due to stderr. I’d use something like:
yum -q check-update 2>/dev/null|grep -c -v ^$
Chris Adams wrote:
Ok, you want it all, fine:
echo “n” | yum update | egrep “Install|Upgrade”
mark