Try 'ps --help <simple|list|output|threads|misc|all>'#[简单|列表|输出|线程|其它|所有] or 'ps --help <s|l|o|t|m|a>' for additional help text. [root@iZf8z5ura2kb73ra6wu0phZ ~]# ps --help a
Usage: ps [options]
Basic options: # 基本的参数选项 -A, -e # 所有进程 -a all with tty, except session leaders a all with tty, including other users -d all except session leaders -N, --deselect negate selection r # 正在运行的进程 T # 在此终端的所有进程 x # 没有终端控制的进程
Selection by list: # 按列表选择 -C <command> # 命令名称,进程命称 -G, --Group <GID> real group id or name -g, --group <group> session or effective group name -p, p, --pid <PID> process id --ppid <PID> parent process id -q, q, --quick-pid <PID> process id (quick mode) -s, --sid <session> session id -t, t, --tty <tty> terminal -u, U, --user <UID> effective user id or name -U, --User <UID> real user id or name
The selection options take as their argument either: a comma-separated list e.g. '-u root,nobody' or a blank-separated list e.g. '-p 123 4567'
Output formats: # 选择输出格式 -F extra full -f #完整格式,包括命令行 f, --forest ascii art process tree -H show process hierarchy -j jobs format j # BSD 工作的控制格式 -l # 长格式输出,较详细的信息 l BSD long format -M, Z add security data (for SELinux) -O <format> preloaded with default columns O <format> as -O, with BSD personality -o, o, --format <format> user-defined format s signal format u user-oriented format v virtual memory format X # 寄存器格式 -y do not show flags, show rss vs. addr (used with -l) --context display security context (for SELinux) --headers repeat header lines, one per page --no-headers do not print header at all --cols, --columns, --width <num> set screen width --rows, --lines <num> set screen height
Show threads: H as if they were processes -L possibly with LWP and NLWP columns -m, m after processes -T possibly with SPID column
Miscellaneous options: # 其它选项 -c show scheduling class with -l option c show truecommand name e show the environment after command k, --sort specify sort order as: [+|-]key[,[+|-]key[,...]] L show format specifiers n display numeric uid and wchan S, --cumulative include some dead child process data -y do not show flags, show rss (only with -l) -V, V, --version display version information and exit -w, w unlimited output width
--help <simple|list|output|threads|misc|all> display help and exit
ps-o pid,ppid,pgrp,session,tpgid,comm ps-eo %cpu,%mem,vsz,rsz,start,stat,pid,sid,ni,uid,user,rss,time,command # 指定进程号 ps-o %cpu,%mem,vsz,rsz,start,stat,pid,sid,ni,uid,user,rss,time,command --pid 19611 %CPU%MEM VSZ RSZ STARTED STAT PID SID NI UID USER RSS TIME COMMAND
进程信息输出到文件
1
ps-aux > ps_aux.txt
分页查看输出的信息
1 2 3
# 用 | 管道和 more 或 less 连接起来分页查看 ps-aux |more ps-ax|less