There are many ways to install software in Linux systems, so there is no universal method to check whether a certain software has been installed. However, I have summarized some types below for your reference:
1. If the rpm package is installed, you can use rpm -qa to see it. If you want to find out whether a certain software package is installed, use rpm -qa | grep "the name of the software or package".
rpm -qa | grep ruby
2. If installed with deb package, you can use dpkg -l to see it. If you are looking for a specific software package, use dpkg -l | grep "the name of the software or package";
dpkg -l | grep ruby
3. If installed using the yum method, you can use yum list installed to search. If you are looking for a specified package, add | grep "software name or package name" after the command;
yum list installed | grep ruby
4. If you compile and install the source code package yourself, such as .tar.gz or tar.bz2, you can only check whether the executable file exists.
Neither of the above two methods can see the package installed in this source code form. If installed as the root user, the executable programs are usually in the /sbin:/usr/bin directory.
There are other methods, please indicate.
The following are the additions from other netizens
1. If the rpm package is installed, you can use rpm -qa to see it. If you want to find out whether a certain software package is installed, use rpm -qa | grep "the name of the software or package"
2. Installed with deb package, you can use dpkg -l to see it. If you are looking for a specific software package, use dpkg -l | grep "the name of the software or package"
3. If installed using the yum method, you can use yum list installed to search. If you are looking for a specified package, use yum list installed | grep "software name or package name"
The above is the detailed content of Check if Linux has a specific package installed. For more information, please follow other related articles on the PHP Chinese website!