Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

On other Unixe,s I can use top and then hit K and type the process ID. How can I do that in OS X?

I can type kill [the_pid] on its own at the command line and that works. However, I was wondering if there was a way for it to happen while in the top program.

share|improve this question
1  
if you're on other *NIXes, you've probably already used htop. I find it to be more informative and consistent from machine to machine. It's available via MacPorts. –  ephsmith Aug 15 '12 at 1:41

2 Answers 2

up vote 2 down vote accepted
# top

press shift + s. This will bring up:

signal [TERM]:

At this point you can just press return for a 'polite' process end request ("signal 15") that will let the process clean up files, release memory, etc. For process that can't be killed this way, you can enter the word ‘kill’ which is signal "9" then press return.

Now top prompts for a pid (process id):

pid:

Enter the pid of the process you want to kill and that should take care of it.

share|improve this answer
1  
I wouldn't use SIGKILL as the first choice. The suggested SIGTERM should do for most processes. SIGKILL terminates a process without any recourse or clean-up, possibly leaving a "zombie" process that still has open file descriptors, allocated memory, etc. –  Jan Steinman Aug 16 '12 at 20:35
    
Thanks Jan. However I see no mention of SIGKILL in this answer. Presumably implied? Also if SIGTERM is a better option please state exactly what to type. –  Michael Durrant Aug 26 '12 at 12:42
    
ok, I'll just update it myself. –  Michael Durrant Aug 30 '12 at 15:38

From the top man page:

  S<signal><pid>
          Send  <sig>  to  <pid>.   <sig> can be specified either as a number or
          as a name (for example, HUP).  The default signal starts out as TERM.
          Each time a signal is  successfully  sent,  the default signal is updated
          to be that signal.  <pid> is a process id.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.