Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to see process with arguments in windows using any cygwin utilities

If I use ps -efW, it is listing the Windows processes, but not with command-line arguments.

I came across three links where I was told to use pstree, /proc/PID/cmdline, and procps.

http://cygwin.com/ml/cygwin/2007-04/msg00813.html

http://cygwin.com/ml/cygwin/2007-04/msg00817.html

http://cygwin.com/ml/cygwin/2007-04/msg00821.html

However, I dont find any except procps in Cygwin 32-bit packages.

Even after I installed procps, I don't know how to use it. I read the man page, but didn't get a clue.

Can someone please help?

For example, using the wmic command, I can see the complete process with arguments.

C:\Users\test1>wmic process get ProcessID, Commandline /format:csv |grep cmd
OSWIN7VC10-32B1,"C:\Windows\system32\cmd.exe" ,2904
OSWIN7VC10-32B1,C:\Windows\system32\cmd.exe /c c:\ostore74\src\osci\scripts\buil
d_test\nt\batch_conf\winnt_vc100_weekly.bat >C:\Users\test1\AppData\Local\Tem
p\s1io.4 2>C:\Users\test1\AppData\Local\Temp\s1io.5,3968
OSWIN7VC10-32B1,C:\Windows\system32\cmd.exe /c C:\apache-ant-1.7.1\bin\ant.bat -
Djboss.home=C:\ostore74\tmp\javaee\jboss-4.2.3.GA -emacs -k -f C:\ostore74\src\j
mtl\build.xml overnight >> \\ostorenas\odi\ostore_platform_logs\ostore\7.4
.0\test1\winnt_vc100\2013-10-18-1720\unit_retail_jmtl.log 2>&1,1864
OSWIN7VC10-32B1,"C:\Windows\system32\cmd.exe" ,604
OSWIN7VC10-32B1,grep  cmd,2064

However, using the Cygwin ps command.

C:\Users\test1>ps -efW |grep cmd
       0    2904       0 ?          Oct 17 C:\Windows\System32\cmd.exe
       0    3968       0 ?          Oct 18 C:\Windows\System32\cmd.exe
       0    1864       0 ?          Oct 18 C:\Windows\System32\cmd.exe
       0    3200       0 ?        08:39:43 C:\Windows\System32\cmd.exe
like image 312
divakar.scm Avatar asked Oct 23 '13 12:10

divakar.scm


People also ask

How use cygwin terminal in Windows?

Use Cygwin as you would UNIX. It might require a bit of customization. For example, adding your user name to "/etc/password." Make sure you allow it to put an icon on your desktop during setup. When you double-click that icon, it will open up a shell window.

How can I see what processes are running Windows command line?

First of all open the Start Screen and type Cmd utility in search box then click on the search button. Click on the cmd utility icon; it opens a command-line window. Type Tasklist in it and press the enter key. This command shows all the running processes in your system.

What is cygwin utility?

Cygwin is a collection of open source tools that allows Unix or Linux applications to be compiled and run on a Microsoft Windows operating system (OS) from within a Linux-like interface.


2 Answers

If you need arguments only for cygwin processes, you can use

procps -wwFAH

or

pstree -a

(pstree is a part of the psmisc package).

If you need arguments for Windows processes, you can use wmic as well. It works in the Cygwin shell. Alternatively, you can try to patch process.c of the win7util package to include a full command-line.

like image 140
Andrey Avatar answered Sep 27 '22 17:09

Andrey


"pgrep -a" will also do the trick. For example:

$ emacs-w32.exe somefile.txt &

$ pgrep -a emacs
21564 emacs-w32 somefile.txt

$ pgrep -a .   #to see all processes 
like image 20
Phantom of Krankor Avatar answered Sep 27 '22 17:09

Phantom of Krankor