Ask Your Question

Chaining sudo dnf commands

asked 2016-02-13 04:09:22 -0500

La Chamelle gravatar image

updated 2016-02-13 08:42:27 -0500

mether gravatar image


I would like to chain sudo dnf check-update && sudo dnf upgrade -y. I tried the previous but it does not work. I am using bash.


edit retag flag offensive close merge delete


dnf check-update lists available updates for human review; it does the exact same thing as dnf upgrade with N pressed at the end. dnf upgrade -y by itself will achieve the same result, except the list of updates will be shown once instead of twice.

randomuser gravatar imagerandomuser ( 2016-02-13 12:47:52 -0500 )edit

Why are you even bothering with check-update when you're going to be updating regardless of what it reports?

sideburns gravatar imagesideburns ( 2016-02-13 13:07:25 -0500 )edit

I'm guessing this is an attempt to replicate the ubuntuism apt-get update && apt-get upgrade. dnf has a different metadata refresh mechanism; a systemd timer unit /usr/lib/systemd/system/dnf-makecache.timer fires dnf make-cache every hour, which refreshes repo metadata unless a refresh has already been done within 3 hours. The three hours is configurable via metadata_timer_sync in /etc/dnf/dnf.conf

randomuser gravatar imagerandomuser ( 2016-02-13 14:01:50 -0500 )edit

Yes, but using sudo dnf upgrade -y as the second command makes the first one pointless. It's going to run even if the first command reports that there's nothing to do.

sideburns gravatar imagesideburns ( 2016-02-13 14:37:47 -0500 )edit

I just did not know check-update was pointless.

La Chamelle gravatar imageLa Chamelle ( 2016-02-13 16:26:49 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-02-13 08:34:53 -0500

robyduck gravatar image

You can use them as you did, but the '-y' attribute needs to be set before:

sudo dnf check-update && sudo dnf -y upgrade
edit flag offensive delete link more

Question Tools

1 follower


Asked: 2016-02-13 04:09:22 -0500

Seen: 164 times

Last updated: Feb 13 '16