Home  >  Article  >  Operation and Maintenance  >  How to check the installation path of a service in Linux

How to check the installation path of a service in Linux

王林
王林Original
2019-12-26 10:05:318263browse

How to check the installation path of a service in Linux

redis is a service that is often used in the development process. I will take this service as an example to explain.

1. Execute the ps -ef | grep redis command. The results are as follows:

How to check the installation path of a service in Linux

As you can see, only the relative path of the service can be found through the ps command. , detailed information of the process that cannot be found, such as absolute path.

Related learning video sharing: linux video tutorial

2. Execute ps -u system user name to further determine the process id,

My here The system user name is root. Execute ps -u root. The result is as follows:

How to check the installation path of a service in Linux

Combined with the operation result diagram of 1, we can see that the process ID of the redis service is 30058.

3. Enter the Linux process directory/proc, execute ls -l, and you can see the corresponding process directory. The result is as shown in the figure below:

How to check the installation path of a service in Linux

4. Enter the process directory 30058 and execute ls -l. The results are as follows:

How to check the installation path of a service in Linux

When Linux starts a process, the system will create a process named after the PID under /proc. folder, there will be information about our process under this folder, including a file named exe, which records the absolute path, which can be viewed through the ll or ls -l command.

Recommended related articles and tutorials: linux tutorial

The above is the detailed content of How to check the installation path of a service in Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn