DNF and RPM commands are used for installing .rpm packages in Fedora. The only difference between the two is that DNF can automatically identify and install dependencies while RPM automatically does (NOT). One has to run a separate RPM command to resolve dependencies and then more to install them, making the process cumbersome. So, try to use DNF instead of RPM whenever you can.
RPM is generally used to install packages from local sources or to list files of an installed package and their location. For everything else, DNF is used.
DNF is also the successor for YUM utility that is present in other distros like CentOS.
Wildcards: There are two wildcards that one can use – ‘*’ and ‘?’. The asterisk matches any number of characters while ‘?’ matches only one character and that can be any alphabet, number or space.
1) The command will install package “tito”
sudo dnf install tito
2) This command will install all packages that start with “tito”
sudo dnf install tito*
3) This command will install all packages that start or end with “tito” or has the string “tito” in it
sudo dnf install *tito*
4) This command will install “tito” from local directory
sudo dnf install ~/Downloads/tito-0.6.2-1.fc22.noarch.rpm
5) This command will remove a package named “tito131”
sudo dnf remove virtualbox*
6) This command will list all installed packages with “tito” in it
dnf list installed “*tito*”
7) This command will list all installed packages that start with the word “tito”
dnf list installed “tito*”
8) This command will check for the availability of packages. Say you need to know whether packages for VirtualBox are available or not. “sudo” is not required to run this command. Then just type in this command:
dnf list available “virtualbox*”
9) This command determines which package provides a specific file
dnf provides ifconfig
1) To install a package
sudo rpm -i a.rpm
Note: We can give “v” flag that will make it print verbose messages and “h” flag to print # marks to show the progress of the installation of a package.
sudo rpm -ivh a.rpm
2) To install all packages in a single directory
sudo rpm -ivh *.rpm
3) To update a package
sudo rpm -uvh a.rpm
4) To remove a package
sudo rpm -e a.rpm
5) The following command will list all the files of a package along with the location
sudo rpm -ql chromium