Feeds:
Posts
Comments

Posts Tagged ‘command line’

With Ubuntu I use the following to kill an errant process.

$ ps -efH | grep [process-name-regex]

Get the pid from the result and use

$ kill [pid]

When working in windows I wanted an equivalent functionality in command line rather than going to task manager window to get the job done. This is what I found.

Let’s say I want to kill the Intenet Explorer process currently having MSN home page.

tasklist /FI “WINDOWTITLE eq MSN*”

This would list the Internet Explorer process details similar to the below table.

Image Name                 PID          Session Name            Session#            Mem Usage

IEXPLORE.EXE          1168          Console                           0                        24,064K

Now use tskill comand to kill the process using PID.

tskill 1168

That’s it. You are done killing your process. :D.

Note /FI switch in tasklist command is a filter. It filters tasklist output using the window title of the related process. It can be also filtered using the PID or the image name of the process. But I used window title because I may not know the image name or the PID (finding PID is the motive in the first place) of the process. Windows title you can easily see on the desktop. Great thing is that you can use wild cards with the name. See I have used just MSN* in the search pattern. So it would give the process having an open window with title starting with MSN.

The easier way if you know the process name or part of it is directly to use tskill.

tskill <process-name-regex>

For instance for Internet Explorer.

tskill iexplo*

But I have found out some applications have process names which are hard to guess. For example windows chm viewer has a process name of hh.

Advertisements

Read Full Post »