Need help with dnf commands for listing and installing packages to & from a txt file

The command dnf repoquery --userinstalled > ~/installed-packages.txt will give you a file with all the names of packages that were user installed. If you save that file before you do the new install then it can be used to do the new install of those packages on the newly installed F36.

Note that the file names saved will include the version number and distro for which they were installed, so you will need to do a bit of tweaking on the file list to avoid the errors that would result from trying to install fedora 34 packages and versions on fedora 36.

In other words, the command would return a list something like this

xsane-0:0.999-41.fc35.x86_64
xsane-common-0:0.999-41.fc35.x86_64
xsane-gimp-0:0.999-41.fc35.x86_64

and you would need to modify it to something like this before doing the new install so the appropriate fedora 36 package would be installed.

xsane
xsane-common
xsane-gimp

Note that the command given by @vwbusguy above would work similar with a slight modification to read rpm -qa --qf '%{Name} ' > file-list.txt and that it would return a list of all packages installed, not just the user-installed ones.

3 Likes