Kill processes on Win

 

On Linux/Unix it’s very easy to find process ID of certain process:

ps -ef | grep processName 

or

ps aux | grep processName

then the Process ID is the second column of the output (usually written as variable $PID or ${PID})

 kill -9 ${PID}

However, in Windows the command line are much limited, we can use tasklist and taskkill to find the name/PID of the process then kill it.

For example to kill all the instance of Skype.exe and its “children” process on Win:

 taskkill /f /t /im Skype.exe

Or find the PID by the output of  tasklist 

 tasklist | FIND "Skype.exe"

then

taskkill /pid ${PID}

 

We can also use some programming language to invoke a process/thread to killByName and killByPID respectively.

Link:

On recent versions of Windows, there are also WMIC and PowerShell to help find the PID easier, however I will not introduce them here. You may try it yourself ;-) .

 

Bonus: command to restart Windows fast

  shutdown.exe -r -t 0

 

./.

 

About DucQuoc.wordpress.com

A brother, husband and father...
This entry was posted in Linux, Skill. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s