linux command ps aux|grep xxx detailed explanation linux command ps aux|grep xxx detailed explanation

Linux command ps aux|grep xxx detailed explanation

To monitor and control the process, you must first understand the current process, that is, you need to view the current process, and the ps command (Process Status) is the most basic and very powerful process viewing command.

Use this command to determine which processes are running and their running status, whether the process has ended, whether the process has zombies, which processes are taking up too many resources, etc. In short, most of the information can be obtained by executing this command.

 

ps provides us with a one-time view of the process, and the viewing results it provides are not dynamic and continuous;

If you want to monitor the process time, you should use the top tool.

 

If you use the ps command directly, the status of all processes will be displayed, usually combined with the grep command to view the status of a process.

grep (global search regular expression(RE) and print out the line, comprehensive search for regular expressions and print out the line) is a powerful text search tool that uses regular expressions to search for text and print out the matching lines come out.

 

Example of use:

[root@node20 updateDB]# ps aux|grep ./update_stock

root 14232 0.0 0.0 5928 724 pts/1 S+ 18:16 0:00 grep ./update_stock

root 25021 0.0 0.0 3056 816 ? S Apr12 0:03 ./update_stock

 

ps aux output format:

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND

 

Format description:

USER: The itinerary owner

PID: pid

%CPU: occupied CPU usage

%MEM: occupied memory usage

VSZ: size of virtual memory occupied

RSS: occupied memory size

TTY: minor device number of tty of the terminal

 

STAT: The status of the trip, the linux process has 5 statuses:

D uninterruptible uninterruptible sleep (usually IO)

R 运行 runnable (on run queue)

S interrupt sleeping

T 停止 traced or stopped

Z 僵死 a defunct (”zombie”) process

Note: Other states include W (no resident page), < (high priority process), N (low priority process), L (memory lock page).

 

START: Trip start time

TIME: time of execution

COMMAND: command executed

 

 

 

1) ps a Display all programs under the current terminal, including programs of other users.
2) ps -A shows all programs. 
3) When ps c lists programs, it displays the real command name of each program, without the path, parameter or resident service sign. 
4) ps -e The effect of this parameter is the same as specifying the "A" parameter. 
5) When ps e lists programs, it shows the environment variables used by each program. 
6) ps f Use ASCII characters to display the tree structure to express the relationship between programs. 
7) ps -H displays a tree structure, indicating the relationship between programs. 
8) ps -N displays all programs, except for the programs under the ps command terminal. 
9) ps s Displays the program status in the format of program signal. 
10) When ps S lists programs, it includes interrupted subprogram data. 
11) ps -t specifies the terminal number and lists the status of the programs belonging to the terminal. 
12) ps u displays the program status in a user-based format. 
13) ps x displays all programs, not differentiated by terminals.
ps is to display the current state of the running process, grep means to search in these, and ps aux is to display all processes and their status.

$ ps aux | grep amoeba

Find the process of amoeba

$ kill -s 9 pid

kill process

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325017206&siteId=291194637