ps Display the process information, there are several versions ps, therefore the kind ps options are numerous. Just to name a normal development process commonly used commands, if there are errors or better example. Please indicate in the comments area
grammar
ps [options]
parameter
The options parameter
-f: full 展示进程详细信息
-e: every 展示所有进程信息
-ax: all 与 -e 同,展示所有进程信息
-o: 设置输出格式, 可以指定需要输出的进程信息列
-L: 展示线程信息
-C: 获取指定命令名的进程信息
-t: tty 展示关联指定 tty 的进程
--forest: 展示进程数
--sort: 按照某个或者某些进程信息列排序展示
Examples
1. Review all current process information
ps -ef
2. specify the output process information
Such as: output process pid
ps -ef -o pid=
Tips: here =
the purpose is to return results do not include column names
while also supporting other process information more
parameter name | parameter |
---|---|
pcpu | cpu usage |
pid | Process id |
PPID | The parent process id |
Pmem | Memory Usage |
comm | Executable file name |
cmd | Simple Commands |
user | User-initiated process |
nice | Process priority |
time | Accumulated CPU time |
stat | Process State |
3. Find the name given command corresponding to process information
Start a program to obtain information for all processes to bash
ps -C bash
here at the same time can be combined with -o
process parameters, output information specified column
ps -C bash -o pid=
4. Display system information of the current thread
ps -eLf
5 shows the process tree
ps -ef --forest
6. Display ordering process in accordance with certain properties
According to cpu
the sort
ps -e --sort pcpu
attribute field the same parameter -o (eg pcpu, pmem etc.). Multiple conditions separated by commas