Linux to check whether the software is installed and the installation path

1. Check if the software is installed

Because there are many ways for Linux to install software, there is no universal way to check whether certain software is installed.
1. rpm package installation
You can use rpm -qa to view, if you want to view a certain software rpm -qa | grep software name
For example: rpm -qa | grep mysql

[root@localhost ~]# rpm -qa | grep mysql
mysql-community-libs-5.7.28-1.el7.x86_64
mysql-community-client-5.7.28-1.el7.x86_64
mysql-community-libs-compat-5.7.28-1.el7.x86_64
mysql-community-common-5.7.28-1.el7.x86_64
mysql-community-server-5.7.28-1.el7.x86_64
mysql57-community-release-el7-8.noarch

2. Install
with deb package Use dpkg -l to view and view a certain software dpkg -l | grep software name
For example: dpkg -l | grep ruby

3. Installed by yum method
Use yum list installed to search for a certain software yum list installed | grep software name
For example: yum list installed | grep nginx
4. If the source code package is compiled and installed by yourself
such as .tar.gz or tar. In the form of bz2, this can only be seen if the executable file exists, neither of the above two methods can see the package installed in this source form. If installed as the root user, the executable programs are usually in the / sbin or / usr / bin directory.

Note : where rpm yum is the package management command of Redhat Linux, and dpkg is the package management command of debian series.

2. View the installation path

  1. View installation path
    [root @ localhost ~] # whereis mysql
    mysql: / usr / bin / mysql
    —execution path / usr / lib64 / mysql —installation path
    / usr / share / mysql —default site path
    / usr / share / man / man1 /mysql.1.gz

  2. The address where the running file of the query file is located
    [root @ localhost ~] # which mysql
    / usr / bin / mysql

Published 97 original articles · praised 3 · 10,000+ views

Guess you like

Origin blog.csdn.net/qq_39530821/article/details/102994912