Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Ps (Process Status) process status: lists the currently running processes

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

1、ps -ef |grep program name

View the running status of a program, see if a program is running, find out the process id to end the program.

The parameters of this command are explained separately below:

-e Displays all processes.

-f Full format.

2. For example, check the running state of mysql:

#ps -ef | grep mysql

(1) mysql program is not installed, the output is as follows:

root 177659 171181 0 11:32 pts/0 00:00:00 grep mysql

(2) mysql is not running, output

grep mysql

This line.

(3) Running mysql program, output content:

root 7355 7338 0 11:34 pts/0 00:00:00 grep mysql

root 14066 1 0 May17 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/data/mysql5.7 --socket=/data/mysql5.7/mysql.sock --pid-file=/var/run/mysqld/mysqld.pid --basedir=/usr --user=mysql

mysql 14318 14066 0 May17 ? 13:15:09 /usr/sbin/mysqld --basedir=/usr --datadir=/data/mysql5.7 --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/data/mysql5.7/mysql.sock

The following explains the meaning of each output item (illustrated by the output of the command above):

The first column (root) indicates which user started the process.

The second column (7355, 14066, 14318) represents the id of the process

The third column (7338, 1, 14066) indicates the id of the parent process above it.

Column 4 (0, 0, 0) Percentage of resources used by CPU

The last column represents the commands and parameters for starting the process (think later

3. End the process command:

#kill process id

Force End Process Command:

#kill -9 process id

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report