Ralf Prengel
2019-May-22 13:42 UTC
[CentOS] how to find out the number of updates for a system
Hallo, I need the information how many updates are available for a system. What is the best way to find it out in a one line bash script. Von meinem iPad gesendet
Ralf Prengel wrote:> Hallo, > I need the information how many updates are available for a system. > What is the best way to find it out in a one line bash script. >yum check-update, perhaps? mark
Steffen Kröger
2019-May-22 14:32 UTC
[CentOS] how to find out the number of updates for a system
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 "^$" -- Sent from the Delta quadrant using Borg technology! Nux! www.nux.ro ----- Original Message -----> From: "Ralf Prengel" <ralf.prengel at rprengel.de> > To: "CentOS mailing list" <centos at centos.org> > Sent: Wednesday, 22 May, 2019 14:42:53 > Subject: [CentOS] how to find out the number of updates for a system> Hallo, > I need the information how many updates are available for a system. > What is the best way to find it out in a one line bash script. > > Von meinem iPad gesendet > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centos
Chris Adams
2019-May-22 14:48 UTC
[CentOS] how to find out the number of updates for a system
Once upon a time, mark <m.roth at 5-cent.us> said:> Ralf Prengel wrote: > > Hallo, > > I need the information how many updates are available for a system. > > What is the best way to find it out in a one line bash script. > > > yum check-update, perhaps?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. -- Chris Adams <linux at cmadams.net>
You might want to increase 1000 if you expect to have more than that number of updates :) -- Sent from the Delta quadrant using Borg technology! Nux! www.nux.ro ----- Original Message -----> From: "Nux!" <nux at li.nux.ro> > To: "CentOS mailing list" <centos at centos.org> > Sent: Wednesday, 22 May, 2019 15:48:00 > Subject: Re: [CentOS] how to find out the number of updates for a system> yum check-updates 2>/dev/null|grep -A1000 "^$"|grep -vc "^$" > > -- > Sent from the Delta quadrant using Borg technology! > > Nux! > www.nux.ro > > ----- Original Message ----- >> From: "Ralf Prengel" <ralf.prengel at rprengel.de> >> To: "CentOS mailing list" <centos at centos.org> >> Sent: Wednesday, 22 May, 2019 14:42:53 >> Subject: [CentOS] how to find out the number of updates for a system > >> Hallo, >> I need the information how many updates are available for a system. >> What is the best way to find it out in a one line bash script. >> >> Von meinem iPad gesendet >> _______________________________________________ >> CentOS mailing list >> CentOS at centos.org > > https://lists.centos.org/mailman/listinfo/centos
SternData
2019-May-22 15:03 UTC
[CentOS] how to find out the number of updates for a system
maybe yum -q check-update | wc -l On 5/22/19 8:42 AM, Ralf Prengel wrote:> Hallo, > I need the information how many updates are available for a system. > What is the best way to find it out in a one line bash script. > > Von meinem iPad gesendet > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centos >-- -- Steve
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 ^$ -- Sent from the Delta quadrant using Borg technology! Nux! www.nux.ro ----- Original Message -----> From: "SternData" <subscribed-lists at sterndata.com> > To: "CentOS mailing list" <centos at centos.org> > Sent: Wednesday, 22 May, 2019 16:03:39 > Subject: Re: [CentOS] how to find out the number of updates for a system> maybe > yum -q check-update | wc -l > > On 5/22/19 8:42 AM, Ralf Prengel wrote: >> Hallo, >> I need the information how many updates are available for a system. >> What is the best way to find it out in a one line bash script. >> >> Von meinem iPad gesendet >> _______________________________________________ >> CentOS mailing list >> CentOS at centos.org >> https://lists.centos.org/mailman/listinfo/centos >> > > > -- > -- Steve > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centos