Ps -ef |grep archives - The Real (and Virtual) Adventures of Nathan the IT Guy

The Real (and Virtual) Adventures of Nathan the IT Guy:

ps -ef |grep

Oct 27 2009   3:42PM GMT

How to Properly kill a VM



Posted by: Nathan Simon
vmware, vsphere, how to find the PID of a vm, PID, vmx, vmware-cmd, vmware-cmd stop, vmware-cmd stop hard, vm won't respond, kill -9 PID, ps -ef |grep, ps auxfww | grep, ESX Server 3.5

We all know that you can use the command “ps -ef |grep (vmconfig filename.vmx)” to find the PID for a VM, but I get confused as to which number that comes up is actually the PID… I found a new command that works much better. See below.

The Definitive way to Kill a PID process

The steps below are based on the fact that you already tried to use “vmware-cmd vmname.vmx stop; stop hard”

1.)    A final solution is to kill the PID (process ID). Issue the following command: “ps auxfww | grep <vmname>” to locate the correct PID (BTW: this cannot be done via *ESXTOP*). The first number to appear in the output is your PID. The PID can be used to terminate the process by issuing kill -9 PID.

2.)    Run vmware-cmd <vmname>.vmx getstate to see if it is now “off”, as it should be.

3.)    You can now go back into Virtual Infrastructure Client and start the machine.

-NS