Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
以前一直在AIX系统下玩,今天无意在linux下运行一个命令,出现如下错误:
[root@erpdemo ~]# ps -aux
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
……
奇怪?这个命令在AIX下运行一点也没有问题,提示语法错误? 看来命令书写有错误,ksh和bash的区别吗?然后换一种方式
[root@erpdemo ~]# ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 10344 684 ? Ss 2010 1:33 init [3]
root 2 0.0 0.0 0 0 ? S< 2010 0:01 [migration/0]
我们继续去分析问题,man ps
EXAMPLES
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
a Lift the BSD-style "only yourself" restriction, which is imposed upon the set of all processes when some BSD-style (without "-")
options are used or when the ps personality setting is BSD-like. The set of processes selected in this manner is in addition to
the set of processes selected by other means. An alternate description is that this option causes ps to list all processes with a
terminal (tty), or to list all processes when used together with the x option.
<EOF>