Sunday, May 20, 2012

Warning: bad syntax, perhaps a bogus ‘-’? See /usr/share/doc/procps-3.2.7/FAQ

I type the following command:
ps -auxf | sort -nr -k 4 | head -10
And I get the output along with warning message:
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
How do I fix this problem?

To fix this problem change your command as follows:
ps auxf | sort -nr -k 4 | head -10

But why does "ps -aux" complain about a bogus '-'?

According to the POSIX and UNIX standards, the above command asks to display all processes with a TTY (generally the commands users are running) plus all processes owned by a user named "x". If that user doesn't exist, then ps will assume you really meant "ps aux". The warning is given to gently break you of a habit that will cause you trouble if a user named "x" were created. This is documented in /usr/share/doc/procps-3.2.7/FAQ file:
less /usr/share/doc/procps-3.2.7/FAQ

No comments:

Post a Comment