Finding Windows XP process ID

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}’).

Select columns.

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.

Task Manager

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.

This entry was posted in Uncategorized and tagged , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

6 Comments

  1. Posted June 14, 2007 at 1:04 pm | Permalink

    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.

  2. Posted June 14, 2007 at 10:14 pm | Permalink

    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.

  3. Posted August 14, 2008 at 9:31 am | Permalink

    You should definitely find a better job… actually that was pretty well written :) I hate svchost sometimes btw.

  4. Jay
    Posted March 11, 2009 at 2:27 pm | Permalink

    It was help ful.

  5. Z
    Posted May 21, 2009 at 12:23 pm | Permalink

    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.

  6. Hellboy
    Posted July 19, 2009 at 9:23 am | Permalink

    Loved it, I too had been using netstat that returned Pid but didn’t know how to work out which process it was.
    Thanks

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*
Check out the latest GroovyMag to see an interview with me about the 1.1 release of GrailsUI: