Skip to content

How To Blog

how to

  • The State of Smart Home Printer Technology – Convenient, But Not All That Smart Smart Home
  • How to Connect Sony WH1000-XM4 to 2 Devices How-To
  • Top 5 Tablets to Increase Productivity Gadgets
  • 4 Best Word to PDF Converter For Mac How-To
  • How To Rip Your DVDs & Blu-Rays Effortlessly With MakeMKV Tools Review
  • How to Save Web Page to Word Document Fast and Easy Computer Tips
  • What is WiFi 6 and Is It Worth Waiting For? Computer Tips
  • How Does the YouTube Algorithm Work? Google Software/Tips

How to Use the Command Line to Kill a Program

Posted on October 6, 2020 By blog_786 No Comments on How to Use the Command Line to Kill a Program

Everyone knows how to kill a program using Task Manager on Windows or Force Quit on OS X, but sometimes it is helpful to kill a program using the command line. I ran into several situations where the program refused to exit through the task manager even when I tried to kill the underlying process. Force Quit has its quirks and doesn’t always kill the program the way it should. Then you can use the full power of the command line.

In this article, I will introduce the commands to shutdown the program on Windows, OS X and Linux. Interestingly, there are usually several commands used for this, so I’ll try to mention the different ones I used. This is not an exhaustive list, so if you are using another command not mentioned here please let us know in the comments.

Windows – TSKILL and TASKKILL

On Windows, you can use two commands to kill the program: TSKILL and TASKKILL. TSKILL is a simpler and less powerful command, but it does its job well. For example, if you are using Microsoft Word, the process name is winword.exe. To kill Word from the command line, simply enter the following command:

tskill winword

This will kill Word and you will lose all unsaved data, so you must be careful when using it. I tried it on an unsaved Word document and it just disappeared when I ran this, no prompts to save documents. This is pretty much true of all the commands I’m going to mention here, as it’s kind of a gist. You can kill the program instantly without asking questions.

It should be noted that in most cases this command is used with the / A. / A option instructs the command to end the process running in all sessions. Therefore, as a rule, you should enter the following command to be sure that the process is complete:

tskill / A winword

The second command, which has more parameters and is more powerful, is TASKKILL. If you look at the TASKKILL man page, you can see what I mean:

If you want more control and ability to uninstall a program in Windows, use TASKKILL. First, you can kill the program using the following command:

taskkill / F / IM winword.exe

Note that you must use .EXE when using the TASKKILL command. / F means force termination of the process. / IM stands for the name of the image, i.e. the name of the process. If you want to kill using the process id (PID) you need to use / PID instead of / IM. / T is great because it will kill all child processes started by the specified process.

You can also use TASKKILL to remotely connect to another system and terminate the process on that remote system. What I also like is the ability to use wildcards in TASKKILL.

OS X / Linux – kill and be killed

On OS X and Linux, you have two commands to kill processes: KILL and KILLALL. You must run them in a terminal window. To kill a program, you must use either the program name or the process ID. There are several ways to find this information. One way is through Activity Monitor.

However, this requires a graphical interface. If you are using the command line to kill a process, you can also use the command line to find information about the process. Two commands come to mind: top and ps -ax.

top will give you a list of processes with PID and program name, also sorted by CPU load. This is a quick way to find the process to kill. ps -ax will give you a list sorted by PID and program path. It is slightly different from the top one.

Now for the program termination in OS X. You can simply enter the following command to kill a specific process:

kill -9 83002

83002 is a terminal process, and 9 means it is destroyed. You can use other numbers, such as 3 for exit, or 6 for interrupt. However, in most cases you will stick with 9. You can also use the KILL command to kill all running processes, although you should probably never use this command.

kill -TERM -1

If KILL is used to kill one or all processes, KILLALL is used to kill the process group. For example, if you are using Google Chrome, you may have 10 Chrome processes running. It would be very frustrating to use KILL ten times to close Chrome. Instead, you can use KILLALL like this:

killall Evernote or killall ‘Google Chrome’

Please note that you must use single quotes or anything longer than one word. Also, if the process is not running under your name but instead is running as root, you should use the following command:

sudo killall ‘Google Chrome’

or

sudo killall -9 ‘Google Chrome’

Again, 9 sends a specific KILL signal, not TERM. Sudo is only required if you get a permission denied message. Otherwise, you can run the killall program or the killall -9 program. On OS X, the KILLALL command comes in very handy when you can’t force a program to close. You don’t need to know the process ID, which is good. Just enter a name and all processes associated with that name will be killed.

This article was intended to give you more advanced methods of killing a program on Windows, OS X and Linux. If you have any questions about uninstalling the program from the command line, please leave a comment and I will try to help. Enjoy!

–

Computer Tips, OS X

Post navigation

Previous Post: OTT Explains – What is Port Forwarding and What is It Used For?
Next Post: How to Properly Setup Recovery and Backup Options for Two-Factor Authentication

Related Posts

  • Clean Up Disk Space in Windows to Increase Performance Computer Tips
  • How to Make Blurry Pictures Clear Computer Tips
  • How to Transfer Art in Procreate to Photoshop with Layers Computer Tips
  • How to Automatically Move or Copy Files in Windows Computer Tips
  • How to Tell if an Email is Fake, Spoofed or Spam Computer Tips
  • Create a Smarter LinkedIn Resume: 7 Tips & Tricks Computer Tips

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Apple Watch
  • Computer Tips
  • Cool Websites
  • Free Software Downloads
  • Gadgets
  • Gaming
  • General Software
  • Google Software/Tips
  • Hardware
  • How-To
  • iOS
  • iPad
  • iPhone
  • Linux Tips
  • macOS
  • MS Office Tips
  • Networking
  • Product Reviews
  • Reviews
  • Safari
  • Smart Home
  • Smartphones
  • Software Reviews
  • technology
  • text
  • Tutorials
  • Uncategorized
  • Urdu Books PDF
  • Web Site Tips
  • Windows
  • Windows 10
  • January 2023
  • December 2022
  • November 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • December 2019
  • July 2019
  • May 2019
  • April 2019
  • January 2019
  • December 2018
  • November 2018
  • October 2018

2021 Android ) Apple apps Best browser change Chrome Closing words Concluding remarks Download Error Facebook From Google Image Internet Keyboard Mac make Movies Music online Packaging phone? Photos Print Search Shortcuts sites Switch Time Tips Tricks turn using Video Videos Watch What With Word Working? your YouTube

  • View the List of Services Hosted by the svchost.exe Process in Windows How-To
  • How to check voicemail on android Smartphones
  • How to Clean Install iOS 11 on iPhone or iPad iOS
  • Quickly Get Rid of “App is Using Battery Notification” How-To
  • Fix VSS Issue CAPI2 Error ID 513 Fixes
  • Bulk Delete Pictures and Videos from iPhone Camera Roll Smartphones
  • How To Fix , if PS5 Not Connecting to TV? Gaming
  • 5 Websites You Should Consult Before Moving

    5 Websites You Should Consult Before Moving

Copyright © 2023 How To Blog.

Powered by PressBook News WordPress theme

Manage Cookie Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Manage options Manage services Manage vendors Read more about these purposes
View preferences
{title} {title} {title}
Go to mobile version