ubuntu 进程管理

上一篇 / 下一篇  2012-03-06 14:32:58 / 个人分类:ubuntu

进程管理,最具代表性的是ps (process status)
ps语法有两种风格
System V 简称为UNIX风格,选项可以分开或合并写在一起,但一定以 “-”开头,例如:
ps -ax    或     ps -a -x

BSD 风格,选项可以分开或合并写在一起,但一定不可以使用“-”,例如:
ps ax    或   ps a x

有些系统只支持一种风格,但对于GNU/Linux 而言,两种都支持。

举个实际例子,假如想结束掉skype进程。(不得不说,ubuntu下skype太经常挂掉了)

方法一:
ps axu

#15178 pts/4    Ss+    0:00 bash
#15973 ?        Sl    12:53 skype
#17597 pts/5    Ss     0:00 bash
#18832 pts/5    R+     0:00 ps ax

kill 15973

方法二:
pkill skype

方法三:
ps axu|grep skype

#zdu      15973  1.0  2.0 335796 79392 ?        Sl   Mar05  12:55 skype
#zdu      18901  0.0  0.0   3324   816 pts/5    S+   15:06   0:00 grep --color=auto skype

kill 15973

TAG:

BM 引用 删除 duzilonglove   /   2012-04-16 22:40:39
-A :所有的 process 均显示出来,与 -e 具有同样的效用;
-a :不与 terminal 有关的所有 process ;
-u :有效使用者 (effective user) 相关的 process ;
x :通常与 a 这个参数一起使用,可列出较完整信息。

输出格式规划:
l :较长、较详细的将该 PID 的的信息列出;
j :工作的格式 (jobs format)
-f :做一个更为完整的输出。
-w              Wide output. Use this option twice for unlimited width.
w               Wide output. Use this option twice for unlimited width.


用自己的话说:
ps aux  显示不与terminal 有关的有效使用者 (effective user) 相关的所有进程

ps -ef  显示所有进程
= ps -Af

To see every process on the system using standard syntax:
   ps -e
   ps -ef
   ps -eF
   ps -ely
To see every process on the system using BSD syntax:
   ps ax
   ps axu
 

评分:0

我来说两句

Open Toolbar