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
 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'.


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. The w 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:

ps ww 2180 2182

(where 2180, 2182 are example PIDs).

  • … and if you give a non-option argument PID, you get (sloppy) SysV syntax again, right? Hence ps -w -p 2180 2182 is (sloppy) SysV syntax, while ps -w -p 2180 -p 2182 (where each PID has a -p) is BSD syntax. … right? – The Sidhekin Nov 16 '15 at 23:30
  • Thanks user318..., the issue seems to an output format specifier is switched from COMMAND to CMD if a single process is reported on in my example. Switching to a 'pure BSD' format works fine (i.e. drop the "-p", or remove the hyphen from "-w"). – Happyblue Nov 17 '15 at 0:14
  • Thanks 'The Sid...'. But " ps -w -p" seems to force the use of the CMD output format specifier (does not report the command line) by default – Happyblue Nov 17 '15 at 0:24
  • I think its a bug in ps implementation (The man page states "-ww" and "ww" are equivalent, yet default output format specifier changes if more than one process is reported on). – Happyblue Nov 17 '15 at 22:40
  • @Happyblue: I think having two totally different modes is confusing, but the man page is correct. It says "BSD options, which may be grouped and must not be used with a dash." So even though the descriptions of w and -w are the same, the two options are not the same (one is BSD, one UNIX). man7.org/linux/man-pages/man1/ps.1.html – user3188445 Nov 18 '15 at 6:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.