Summary of common commands for RPM file operations in Linux

  • 2020-05-13 04:19:21
  • OfStack

Introduction to the

It is well known that in the Linux operating system, there is a software package, which functions like the "add/remove program" in Windows, but is much better than the "add/remove program", which is Red Hat Package Manager(RPM for short). This article describes the common commands for operating RPM files in Linux. Without further details, let's take a look.

1. Installation of RPM

Command:

rpm -i The file name of the package you need to install

Examples are as follows:

rpm -i example.rpm Install the example.rpm package;

rpm -iv example.rpm Install the example.rpm package and display the file information being installed during installation;

rpm -ivh example.rpm Install the example.rpm package and display the file information being installed and the installation progress during the installation process;

2. RPM query operation

Command:

rpm -q ...

Additional query command:

a queries all installed packages the following two additional commands are used to query information about installed packages;

i displays installation package information;

l shows where all the files in the installation package are installed;

s displays the status of all files in the installation version and the directories to which they were installed. The following two additional commands specify whether you want to query the installed package or the installed files;

p queries the information of the installation package;

f queries a file that has been installed;

Examples are as follows:

rpm -qa | grep tomcat4 Check if tomcat4 is installed;

rpm -qip example.rpm See the example.rpm installation package information;

rpm -qif /bin/df View the installation package where the /bin/df files are located;

rpm -qlf /bin/df See which directory each file in the /bin/df installation package is installed into.

3. RPM uninstall operation

Command:

rpm -e Install packages that need to be uninstalled

It is usually used before uninstalling rpm -i example.rpm0 ... The command finds the name of the installation package to uninstall.

Examples are as follows:

rpm -e tomcat4 Uninstall the tomcat4 package

4. RPM upgrade operation

Command:

rpm -U Packages that need to be upgraded

Examples are as follows:

rpm -Uvh example.rpm Upgrade the example.rpm package

5. RPM verification operation

Command:

rpm -V Packages that need to be validated

Examples are as follows:

rpm -Vf /etc/tomcat4/tomcat4.conf

The output information is similar to the following:


S.5....T c /etc/tomcat4/tomcat4.conf 

Where, S indicates that the file size has been modified and T indicates that the file date has been modified. Limited by space, please refer to rpm help file for more verification information: man rpm

6. Other additional commands for RPM

--force Forced operation such as forced installation and deletion;

--requires Shows the dependencies of the package;

--nodeps Ignore the dependencies and continue

conclusion


Related articles: