Question about the ps command, missing option -o to format the output

Holger Dietze holger.dietze@inforsacom.com
Wed Mar 26 13:20:00 GMT 2014


Hello,

I am writing some scripts for linux and cygwin. To find out, if
a given pid (from /var/run/<pidfile> is really the pid of the
correct process I use the ps command on linux (and AIX, Solaris,
even HPUX with a trick) with the option -o pid=

Example:

# ps -ef | grep bash
root      1118  1112  0 11:55 pts/4    00:00:00 -bash
root      1195  1118  0 11:55 pts/4    00:00:00 grep bash
root     21885 21883  0 10:44 pts/3    00:00:00 -bash
root     31068 31065  0 Feb07 pts/1    00:00:00 bash

# ps -p 31068 -o pid= -o comm= 
31068 bash

Trying same command on cygwin:

Administrator@server ~
$ ps -ef | grep bash
Administ    6456    4184 pty1     11:56:59 /usr/bin/bash

Administrator@server ~
$ ps -p 6456
      PID    PPID    PGID     WINPID   TTY     UID    STIME COMMAND
     6456    4184    6456       7016  pty1     500 11:56:59 /usr/bin/bash

Administrator@server ~
$ ps -p 6456 -o pid=
ps: unknown option -- o
Try `ps --help' for more information.

Administrator@server ~
$


I have searched the man page and the Cygwin projects, but did not found a way to get
this working.

Is this a feature request?

Thanx, Holger


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list