Monday, June 18, 2012

cygwin windows processes and ps: the W option

http://cygwin.com/cygwin-ug-net/using-utils.html


Hard to believe I haven't been bothered by this before: if one runs ps in cygwin Windows processes are not displayed unless the W option is used.



$ ps -ef | grep post*
-- nothing



$ ps -efW | grep post*
       0    3220       0 ?          Jun 17 D:\PostgreSQL\9.1\bin\postgres.exe
       0    5684       0 ?          Jun 17 D:\PostgreSQL\9.1\bin\postgres.exe
       0    3808       0 ?          Jun 17 D:\PostgreSQL\9.1\bin\postgres.exe
       0    3072       0 ?          Jun 17 D:\PostgreSQL\9.1\bin\postgres.exe
       0    3620       0 ?          Jun 17 D:\PostgreSQL\9.1\bin\postgres.exe
       0     412       0 ?          Jun 17 D:\PostgreSQL\9.1\bin\postgres.exe

Unfortunately I've not found a cygwin way to kill the Windows processes.  I'm stuck with the Windows way:

$ kill -9 1600
-bash: kill: (1600) - No such process



$ taskkill /F /PID  1600

SUCCESS: The process with PID 1600 has been terminated.