输入:ps axo,查看ps命令如下
********* simple selection ********* ********* selection by list *********
-A all processes -C by command name
-N negate selection -G by real group ID (supports names)
-a all w/ tty except session leaders -U by real user ID (supports names)
-d all except session leaders -g by session OR by effective group name
-e all processes -p by process ID
-q by process ID (unsorted & quick)
T all processes on this terminal -s processes in the sessions given
a all w/ tty, including other users -t by tty
g OBSOLETE – DO NOT USE -u by effective user ID (supports names)
r only running processes U processes for specified users
x processes w/o controlling ttys t by tty
*********** output format ********** *********** long options ***********
-o,o user-defined -f full --Group --User --pid --cols --ppid
-j,j job control s signal --group --user --sid --rows --info
-O,O preloaded -o v virtual memory --cumulative --format --deselect
-l,l long u user-oriented --sort --tty --forest --version
-F extra full X registers --heading --no-heading --context
–quick-pid
********* misc options *********
-V,V show version L list format codes f ASCII art forest
-m,m,-L,-T,H threads S children in sum -y change -l format
-M,Z security data c true command name -c scheduling class
-w,w wide output n numeric WCHAN,UID -H process hierarchy
******简单选择
ps -a 显示当前所有进程
[root@tandelin ~]# ps -a
PID TTY TIME CMD
2621 pts/1 00:00:00 su
2622 pts/1 00:00:00 bash
2709 pts/1 00:00:00 su
2712 pts/1 00:00:00 bash
2734 pts/1 00:00:00 su
2735 pts/1 00:00:00 bash
ps -c 显示以运行的命令名的状态显示进程
[root@tandelin ~]# ps -c
PID CLS PRI TTY TIME CMD
20724 TS 19 pts/4 00:00:00 bash
24913 TS 19 pts/4 00:00:00 ps
ps -gn 通过实数组ID否定选择(支持名称)
[root@tandelin ~]# ps -gn
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ
PID TTY STAT TIME COMMAND
1865 tty2 Ss+ 0:00 /sbin/mingetty /dev/tty2
1869 tty3 Ss+ 0:00 /sbin/mingetty /dev/tty3
1873 tty4 Ss+ 0:00 /sbin/mingetty /dev/tty4
1878 tty5 Ss+ 0:00 /sbin/mingetty /dev/tty5
1881 tty6 Ss+ 0:00 /sbin/mingetty /dev/tty6
2533 pts/1 Ss 0:00 -bash
2621 pts/1 S 0:00 su jhadmin
2709 pts/1 S 0:00 su root
2712 pts/1 S 0:00 bash
2734 pts/1 S 0:00 su jhadmin
ps -d除最高权限运行的进程外的其他组进程
[root@tandelin ~]# ps -d
PID TTY TIME CMD
2 ? 00:00:00 kthreadd
3 ? 00:00:00 migration/0
4 ? 00:00:02 ksoftirqd/0
5 ? 00:00:00 stopper/0
6 ? 00:00:00 watchdog/0
7 ? 00:00:00 migration/1
8 ? 00:00:00 stopper/1
t此终端上的所有进程
[root@tandelin ~]# ps t
PID TTY STAT TIME COMMAND
20724 pts/4 Ss 0:00 -bash
26909 pts/4 R+ 0:00 ps t
g过时——不要通过有效的用户ID使用-u(支持名称)
r仅为指定用户运行进程u进程
x进程不通过tty控制ttys t
输出格式**************长选项****
-o,o用户定义的-f full–group–user–pid–cols–ppid
-j,j作业控制s信号–group–user–sid–rows–info
-o,o预加载的-o v虚拟内存–累积–格式–取消选择
-l,l long u面向用户–sort–tty–forest–version
-f额外的全x寄存器–标题–无标题–上下文
——快速PID
******其他选项
-v,v显示版本l列表格式代码f ascii art forest
-m,m,-l,-t,h线程s子级的和-y更改-l格式
-m,z安全数据c真命令名-c调度类
-w,w宽输出n数字wchan,uid-h进程层次结构
也可使用# ps --help
********* simple selection ********* ********* selection by list *********
-A all processes -C by command name
-N negate selection -G by real group ID (supports names)
-a all w/ tty except session leaders -U by real user ID (supports names)
-d all except session leaders -g by session OR by effective group name
-e all processes -p by process ID
-q by process ID (unsorted & quick)
T all processes on this terminal -s processes in the sessions given
a all w/ tty, including other users -t by tty
g OBSOLETE – DO NOT USE -u by effective user ID (supports names)
r only running processes U processes for specified users
x processes w/o controlling ttys t by tty
*********** output format ********** *********** long options ***********
-o,o user-defined -f full --Group --User --pid --cols --ppid
-j,j job control s signal --group --user --sid --rows --info
-O,O preloaded -o v virtual memory --cumulative --format --deselect
-l,l long u user-oriented --sort --tty --forest --version
-F extra full X registers --heading --no-heading --context
–quick-pid
********* misc options *********
-V,V show version L list format codes f ASCII art forest
-m,m,-L,-T,H threads S children in sum -y change -l format
-M,Z security data c true command name -c scheduling class
-w,w wide output n numeric WCHAN,UID -H process hierarchy
USER: 进程所有者
PID: 进程ID
%CPU: 占用的 CPU 使用率
%MEM: 占用的内存使用率
VSZ: 占用的虚拟内存大小
RSS: 占用的内存大小
TTY: 终端的次要装置号码 (minor device number of tty)
STAT: 进程状态:
START: 启动进程的时间;
TIME: 进程消耗CPU的时间;
COMMAND:命令的名称和参数
D 无法中断的休眠状态(通常 IO 的进程);
R 正在运行,在可中断队列中;
S 处于休眠状态,静止状态;
T 停止或被追踪,暂停执行;
W 进入内存交换(从内核2.6开始无效);
X 死掉的进程;
Z 僵尸进程不存在但暂时无法消除;
W: 没有足够的记忆体分页可分配
WCHAN 正在等待的进程资源;
<: 高优先级进程
N: 低优先序进程
L: 有记忆体分页分配并锁在记忆体内 (即时系统或捱A I/O),即,有些页被锁进内存
s 进程的领导者(在它之下有子进程);
l 多进程的(使用 CLONE_THREAD, 类似 NPTL pthreads);