The method is as follows:
1.
The operation command of the rpm software package is rpm. You can install, uninstall, query and other operations on the rpm package. Here We can use the -q parameter with the name of the software package to be queried to directly query. Let's take php as an example:
The command is:
rpm -q php
If not, it will prompt "package php is not installed"
2.
In addition to directly using the name of the software package to query, we can also query all installed software packages in the system and filter out the name of the software package we need to query. This This method is more suitable for situations where we don't know the full name, because we can use regular expressions to pass the name information vaguely. The
command is:
rpm -qa | grep php
or
rpm -qa | grep ph*
If it is not queried, it will not prompt, otherwise the installed software information will be listed.
3.
In addition to using the rpm command, we can also use the yum command to query. We can list the software that has been installed on the system and filter the required query content.
The command is:
yum list installed | grep php
Similarly, if this software is not installed, no relevant information will be prompted.
4.
Finally there is a simpler way to verify. We can try to directly call the command of the software. If the system exists, it will be executed normally, otherwise it will prompt Does not exist. If it does not exist, generally speaking, the software is not installed.
The command is:
python -V php -v
Related tutorial recommendations: centos tutorial
The above is the detailed content of How to check whether a certain software is installed in centos. For more information, please follow other related articles on the PHP Chinese website!