1. View the process: Ps-ef or Ps-aux
Get the PID of the process:
such as:PSgrepgrep"grep"awk'{print $ 2}'
2. Query According to the process number:
# pstree-p Process Number
# TOP-HP Process Number
3. Query According to the process name:
# pstree-p ' ps-e | grep Server | awk ' {print '} '
# pstree-p ' ps-e | grep Server | awk ' {print '} ' | Wc-l
4. View the number of threads
Need to get the PID of the thread
View all threads of a process #PSMp6648-o thread,tiduser%CPU PRI SCNT wchan USER SYSTEM tidroot0.0- - - - - -Root0.0 -- - - -6648Root0.0 +- - - -6650Root1.0 -- - - -14214Root0.0 at-Futex_--14216Root0.0 A-184466- -15374Root0.0 at-184466- -15376Root0.0 at-184466- -15378Root0.0 at-184466- -15380Root0.0 at-184466- -15392Root0.0 at-184466- -15394Root0.0 at-184466- -15398View All child processes: # Pstree-P6648Agent_executor (6648) ─┬─Tar(15601) ───gzip(15607) ├─{agent_executor} (6650) ├─{agent_executor} (14214) ├─{agent_executor} (14216) ├─{agent_executor} (15374) ├─{agent_executor} (15376) ├─{agent_executor} (15378) ├─{agent_executor} (15380) ├─{agent_executor} (15392) ├─{agent_executor} (15394) └─{agent_executor} (15398)
5. Process start time (how long it takes to run)
Ps-eo Lstart Start-up time
Ps-eo ETime How long it takes to run.
Ps-eo Pid,lstart,etime | grep 5176
Explanation of ========================================PS aux or lax output =========================2,PS %cpu%mem VSZ RSS TTY STAT START time Commanduser: Process owner PID: Process ID%CPU: CPU usage %MEM: occupied Memory usage vsz: Virtual memory size consumed RSS: Memory size used TTY: Terminal's secondary appliance number (minor device numbers of TTY) STAT: Process state: Start: Time when the process was started; time: The process consumes the CPU; COMM And: The name and parameters of the command;
Linux view the number of processes and threads