I don’t know if this is a good habit or not, but I’ve grown very comfortable in Linux killing processes by id. The easiest way to do this is to call ‘ps -ef’, pipe it, and grep by the process name. For example, if you want to find out the process id of the firefox instance that is hung up:
ps -ef | grep firefox
This will list all the instances of firefox that are running, and the process id for each. You can easily stop the process by typing ‘kill ${id}’ (or if that doesn’t work, the dreaded ‘kill -9 ${id}’).
So how can we do something similar in Windows? Now when I figured this out today, it seemed like I should have known it for a long time. But there are probably a lot of Windows issues like that. Anyway, open up Task Manager (taskmgr). Now click on the “Processes” tab. Now click on “View –> Select Columns” as shown in the thumbnail on the left
This will allow you to select the Process ID as well as any other information you would like to show on the process list. Check the Process ID and view the process list again.
Now you can tell what processes came first. For example, if you have 3 cmd windows up, but you only want to kill the very first window you opened, you might not know from the process window which one to kill. Now you can sort by process ID and kill the cmd window with the lowest process ID.

6 Comments
I’ve always been annoyed that there’s no way in the Task Manager to see the path of the file that launched the process. If they have the filename (for the “Image Name”), don’t they also have the directory?
It would be very helpful for knowing if the process is launched by the legitimate svchost.exe or malware that smartly used the same name for its executable.
Well if you want a more powerful task manager, check out my latest post on the Process Explorer from Sysinternals. That should provide what you want.
You should definitely find a better job… actually that was pretty well written :) I hate svchost sometimes btw.
It was help ful.
nice…thanks. Had an issue with starting up JBoss and needed to find out what application had port locked. Netstat gave us the PID but did’nt know where to go to resolve it.
Loved it, I too had been using netstat that returned Pid but didn’t know how to work out which process it was.
Thanks