Chinaunix首页 | 论坛 | 博客
  • 博客访问: 99108
  • 博文数量: 78
  • 博客积分: 2522
  • 博客等级: 少校
  • 技术积分: 410
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-05 16:23
文章分类

全部博文(78)

文章存档

2010年(78)

我的朋友

分类:

2010-05-07 19:39:58

很多人一直在使用ps -aux,其实这种用法是错误的,应该使用ps aux和ps -fe。man ps的第一页有一段话:
Note that "ps -aux" is distinct from "ps aux". The POSIX and UNIX standards require that "ps -aux" print all processes owned by a user named "x", as well as printing all processes that would be selected by the -a option. If the user named "x" does not exist, this ps may interpret the command as "ps aux" instead and print a warning. This behavior is intended to aid in transitioning old scripts and habits. It is fragile, subject to change, and thus should not be relied upon.

翻译如下

请注意"ps -aux"不同于"ps aux"。POSIX和UNIX的标准要求"ps -aux"打印用户名为"x"的用户的所有进程,以及打印所有将由-a选项选择的过程。如果用户名为"x"不存在,ps的将会解释为"ps aux",而且会打印一个警告。这种行为是为了帮助转换旧脚本和习惯。它是脆弱的,即将更改,因此不应依赖。

如果你运行ps -aux >/dev/null,那么你就会得到下面这行警告信息
Warning: bad ps syntax, perhaps a bogus '-'? See

如果你在cygwin上运行ps -aux,那么你会得到下面的警告信息
ps: user x unknown

该文章为本人原创,首发LUPA社区 http://www.lupaworld.com/home/space-980-do-blog-id-138758.html

阅读(476) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~