ps Problems
ps
is an incredibly flexible command but it also has a
checkered maintenance history in the Linux world. Yesterday I needed to
output just the username, the command and any arguments passed to it. And
it was hell. After reading through the man page a couple of times I settled
on the following: ps -e -o user,args
. But this doesn’t
work.
It shows the command and the full arguments but it trunks the username
at 8 characters (which doesn’t help with things like exim on Debian - which
has a username of Debian-exim). I then tried switching the order around to
see what happens, and was surprised when ps
decided to
truncate the command and argument details at a seemingly arbitrary (but
consistant) point. GAH!
In the end I was pointed at a more correct, but ugly and not obvious
from the man page, answer; supply a width to the arguments. So to show
multiple fields in ps and not have one of them truncated you need a command
like this: ps -e -o user:20,args
. And a smart friend like
Paul.