[Linux command] ps command

ps command introduction

Used to report the process status of the current system. Can be used with the kill command to interrupt and delete unnecessary programs at any time.

The ps command is the most basic and powerful process viewing command. Using this command, you can determine which processes are running and their running status, whether the process has ended, whether the process is dead, which processes are taking up too many resources, etc.

ps command parameter description

-e View all processes, equivalent to -A
-o Custom output format
-f List all, list more detailed information about each process
-T Display threads
-L Display threads
ps -ef | grep tomcat-web [View Process ID]
ps –o nlwp 27989 [View the number of threads in the process nlwp means number of light-weight process]

ps -eLf [List all threads and processes to which threads belong, including all detailed information]
ps -eLf|grep 722 grep -v "grep" [Use the process ID to view the threads under the process, the output of grep will have grep itself This process is there, use grep -v "grep" to kill this line]
ps -eLo pid,stat,spid | grep 26145 | grep running | wc -l [ps -eL can find all threads, -0 pid,stat ,spid, customize the output format, output according to the process number, status, thread number; two grep commands filter the process number and thread status respectively; wc counts the number]

Guess you like

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