The ps command has a ww
output modifier (man page says this is "wide output, unlimited length"). This modifier seems to not work if prefixed with a hyphen (-ww
) AND ps reports on a single process (with the -p
option).
For more than one process OR if a hyphen isn't used, it works.
Why so? Have I misunderstood what "wide output" means? This is on Redhat RHEL 6.5.
$ ps -w -p 2180
PID TTY TIME CMD
2180 tty1 00:00:00 mingetty
$ ps -w -p 2180 2182
PID TTY STAT TIME COMMAND
2180 tty1 Ss+ 0:00 /sbin/mingetty /dev/tty1
2182 tty2 Ss+ 0:00 /sbin/mingetty /dev/tty2
An output format specifier changes from 'CMD' to 'COMMAND', depending on whether one or more PIDs were fed to '-p'.
Best Answer
ps
has two syntaxes, the BSD and the System V syntax. If you start your options with a hyphen, you are using System V syntax. Thew
flag is a BSD syntax flag. In BSD syntax, you can just specify the process ID without any option. So I think the command you just want is:(where 2180, 2182 are example PIDs).