How to List Installed Package Information on Linux

A Detailed Guide to Using RPM

In the Linux operating system, there is a system package whose functionality is similar to “Add/Remove Programs” in Windows, but much more powerful. It is the Red Hat Package Manager (RPM for short). This tool was first introduced by Red Hat and later adopted by other Linux developers. Because it saves Linux users a lot of time, it is widely used for installing and removing software under Linux. Below is an introduction to its specific usage.

1. When we get a new piece of software, before installing it, we usually want to check what is inside the package. Assuming the file is: Linux-1.4-6.i368.rpm, we can use this command to view it:

rpm -qpi Linux-1.4-6.i368.rpm

The system will list detailed information about this package, including the number of files it contains, each file name, file size, creation time, compilation date, and other details.

2. All the files listed above may not necessarily be installed, just like how program installation in Windows is divided into Typical, Full, and Custom modes. Linux also lets you choose the installation method. We can use the following command to see which parts the package will install in the system, making it easier for us to choose:

rpm -qpl Linux-1.4-6.i368.rpm

3. After choosing the installation method, we start the installation. We can install this software using the command rpm-ivh Linux-1.4-6.i368.rpm. During installation, if the system prompts that this software has already been installed or cannot continue for other reasons, but we indeed wish to execute the installation command, we can add a parameter “-replacepkgs” after -ivh:

rpm -ivh -replacepkgs Linux-1.4-6.i368.rpm

4. Sometimes when we want to uninstall an installed software, we just need to execute the command rpm-e <filename>;.

5. Upgrading lower-version software is a good way to improve its functionality, saving us the trouble of uninstalling and then reinstalling the new software. To upgrade a certain piece of software, simply execute the following command: rpm -uvh <filename>;, note: the filename at this point must be the upgrade patch for the software to be upgraded?
ica, sans-serif; font-size: 13px; line-height: 19px; background-color: rgb(245, 245, 245);” />
6. Another method for installing software is truly unique to Linux and also showcases a powerful feature of RPM: directly installing software online via an FTP site. Once you find a site containing the software you need and connect to it, execute the following command to perform an online installation. For example, to install Linux-1.4-6.i368.rpm online, you can use the command:

rpm -i ftp://ftp.pht.com/pub/linux/redhat/…-1.4-6.i368.rpm

7. Mistakes are inevitable when using a computer. If we accidentally delete a few files that affect system performance, how can we find out exactly which files are missing? The RPM package provides a feature to find corrupted files. Execute this command: rpm -Va, and Linux will list all damaged files for you. You can then repair them using the Linux installation disc.

8. Linux systems contain a multitude of files, and it is common to encounter files we don’t recognize. In Windows, we can use the “Start/Search” menu to quickly determine which folder a file belongs to. In Linux, the following command line helps us quickly identify which software package a file belongs to:

rpm -qf <file name>;

9. After each software package is installed on a Linux system, the installation files “check in” to the RPM database. Therefore, to query the attributes of an installed piece of software, we simply search this database. Note: This query command differs from the ones introduced in steps 1 and 8. This method is only applicable to already installed software packages! The command format is:

rpm -parameter <file name>;

Leave a Comment

Your email address will not be published.