UsingMac.com

Mac Tricks and Tips, Wallpapers and Applications for Mac Users

Terminal Kills Process

Advertisements

Besides using Force Quit Applications to kill crashing or freezing applications, Mac users can also use Terminal to kill these persistent processes.

Like execution of End Process Tree in Windows Task Manager, using Terminal command to kill running process leads to the same effect (but in Terminal way).

Waste no more time, let's begin the assassination.

Identify Running Processes

Within Mac OS X, there are so many running processes that identifying Process ID (PID) by wild-guess is out of the question. Luckily, there is this Terminal command called top to reveal running processes.

top

This running process analyzer can be stopped by pressing Q or Ctrl-C.

Shown Above. Running processes and their PIDs

Kill Identified Processes

Let's say Mail is the process to be killed with its PID 1202. To kill it, this command line can be used :

kill 1202

If there are more than one process to be killed, more PIDs can be appended to the command. For example, you want to stop Mail, TextEdit and GrowlHelper (PIDs are shown on the previous screenshot), then command line below can be used

kill 1202 968 835

The same applies for other processes with their respective process IDs.

Categories: UNIX, Open Source
Tags: Kill, Terminal

Subscribe to RSS Leave a Comment (25)

Related Entries

Some articles taken from our resource base, tightly related to current article, to empower you with more knowledge on tweaking the most out of your Mac.

25 Comments

msb

Or you can just type in killall Mail and don't have to look for the PID.

xonic

also there is no need to write:
kill PID 36670
PID is not needed which leaves us with:
kill 36670

NaVi

Lol, again: terminal is really amazing!

Anon

It's better to quit `top` by hitting 'q' or C-d. C-z only suspends top and it continues running in the background (enter `jobs` to see the currently running programs that have been suspended by C-z, use `fg` to restart top in the foreground after hitting C-z, or use `bg` to tell it to run in the background).

Wendy

Thanks. I've just realized that the process is still running on the background. I think now I should update this article.

Gavin

An easier way of finding the PID is to run Activity Monitor.  If you set the drop down to show 'All Processes' you can see all the running apps, and sort by name or CPU usage (for example) to spot the one you are looking for.  Activity Monitor reports the PID for each process.  So then you can simply open terminal to run the kill command... 

However... an even easier next step is in Activity Monitor to simply select the process (or processes - use Apple+click to select multiple rows) you want to kill and then click the big red "Quit Process" button - which will then ask if you want to soft quit (same as Apple+Q) or force quit (i.e. kill) the process(es).

As with many things on the Mac, it is nice to know that you can find a complex way to do things, but usually you don't need to - just use the tools already provided :)

Patrix

It might also be worth noting that 'top -o cpu' gives you the running processes sorted by amount of cpu currently used (helpful to identify runaway processes hogging the cpu).

jhm

I've been using both Activity Monitor (usually to confirm that a process is not responding) and also just ctr-alt clicking the application on the dock then clicking "Force Quit."

The thing I miss most from Linux, however, is an app which turns the cursor into a skull and crossbones with which one can simply click on an offending window and kill the process responsible.  I generally launched this feature with a key command, which made it really convenient (albeit I admittedly needed to avail myself of it more frequently in Linux than I would with OSX!).

Shaun

I've also read that you can use "kill -9 [pid]" which basically means end the process no matter what. I think you can use that if the regular kill command doesn't work. Just something I remember...might not be relevant.

jay

Anyone know how to scroll (or get to the bottom) of the top list ?   Sometimes my list is so long that i can not see all processes.

augix

kill all your processes:

$ ps -o pid -u username | xargs kill

there will be one error message, doesn't matter.

nelo

when i use de the 'top' command in a terminal windows of 1000 pixels height i can see more process, but if i have a window of just 500 i see just half and i can scroll down to see the rest.

how i page down the top command, i tried many keys and i can't find the way to do it.

JKR

I had troubles with killing a process of "Screenread". I could only find this process in the Activity monitor. 

- Start the terminal. 
- Type the command "top".
- To kill find the PID of this process.

I had troubles with killing "Screenread" because the PID code was changing every second or I couldn't add 'space' between Kill #code (e.g. kill12345 instead of kill 12345). 

So I entered a range of PID codes in my text-editor and pasted it on the command-line via "Shell > New command" (e.g. kill 13401 13402 13403 13404 13405 13406 13407). 

thomas sabo

Honestly, I've always been more of a fan of just putting the monitor to sleep than screen savers. Sure they look pretty awesome, but if you're sitting at your computer, are you really doing so with the screen saver on?Good luck for the dates. It has been some times since we last heard about the next tour. I hope they can run it accordingly now.qsehZN0QKhPfHBkY

headphones

Honestly, I've always been more of a fan of just putting the monitor to sleep than screen savers. Sure they look pretty awesome, but if you're sitting at your computer, are you really doing so with the screen saver on?Good luck for the dates. It has been some times since we last heard about the next tour. I hope they can run it accordingly now.SxMhiPNKXg9UJcXh

thomas sabo

I like these things, every time I see a little bit excited, especially 
thomas sabo uk even more exciting, to be honest I like 
thomas sabo of these things!

jubbimalik

Great things you’ve always shared with us. Just keep writing this kind of posts.The time which was wasted in traveling for tuition now it can be used for studies.Thanks 
Best Real Estate Agent

Genius

Great things you’ve always shared with us. Just keep writing this kind of posts.The time which was wasted in traveling for tuition now it can be used for studies. Forex Robots
 Thanks 

Poko

Je suis heureux que j'ai enfin trouvé ce blog, je ne pouvais trouver aucune information sur ce sujet avant. Цирроз печени Je suis toujours à la recherche pour les personnes à consulter leur site. S'il vous plaît arrêter et laisser un commentaire quelque part! Аскариды Merci pour le post

ea game cd key

It likely could be interesting to see what other folks have to say.

Polk

C'est tellement plaisant de voir quelque chose de nouveau. Лечение ВИЧ  Respecter les propriétaires de sites Bonjour à tous, J'ai l'obtention du diplôme . . . . . et dans mon temps libre, j'aime surfer sur le net pour les nouvelles mises à jour de diverses choses dans le monde признаки отравления

Youtube Comedy Videos

hmm.. didn't get this one :-(

pengembangan diri

that's make apps kill process much more easier.. Is there any way to do it automatically without follow steps above? thank you.
sepatu on line
sepatu futsal

michaerl myers

I always enjoy reading such posts which provide knowledge based information like this Software Akuntansi Laporan Keuangan Terbaik blog. Thanks for sharing it with us.

stone cold

Hi, i think you’ve made some truly interesting points. Not too many people would actually think about this the way you just did. I’m really impressed that there’s so much about this subject that’s been uncovered and you did it so well, with so much class. Good one you, man! Really great stuff here.
Testking JN0-101///	Testking 352-001///	Testking 1Y0-A18///	Testking 1Y0-A19///	Testking 70-290///	Testking EX0-101///	Testking 70-685///	Testking 70-659///

Leave a Comment