I have launched iperf in daemon mode with iperf -s -D and now I want to stop the service. I tried to use sudo kill pid but it neither work nor complain. The daemon is still running when I check through ps -ef | grep iperf.

As it is not launched by Linux, I cannot find it through service as other daemons.

How could I stop it?

7 Answers 7


Don't use kill -9! This command is meant to be used in some specific extreme cases only.

According to the man page (on my Solaris box):

 The kill utility sends a signal to the process or  processes
 specified by each pid operand.

 For each pid operand, the kill utility will perform  actions
 equivalent to the kill(2) function called with the following

 1.  The value of the pid operand will be  used  as  the  pid

 2.  The sig argument  is  the  value  specified  by  the  -s
     option,  the  -signal_name option, or the -signal_number
     option, or, if none of these options  is  specified,  by

 The signaled process must belong to the current user  unless
 the user is the super-user.

When you don't specify any signal, kill will send SIGTERM (kill -15) to your process. There are more aggressive signals you can send that are less violent than SIGKILL (kill -9).

Why avoid kill -9?

SIGKILL is a very violent signal. It cannot be caught by the process, which means that the process that recieves it has to drop everything instantly and exit. It doesn't take the time to liberates resources it has locked (like network sockets or files) nor to inform other processes of exiting. Often, it will leave your machine in an unstable state. Drawing an analogy, you could say that killing a process with SIGKILL is as bad as turning off the machine with the Power button (as opposed to the shutdown command).

As a matter of facts, SIGKILL should be avoided as much as you can. Instead, as mentioned in the article, it's suggested that you try kill -2 and if that doesn't work kill -1.

I've seen people rush into sending SIGKILL all the time (even in daily clean up scripts!). I fight with my teammates daily about this. Please, don't use kill -9 blindly.

  • 2
    I would add conditions to your statement. Don't use kill -9 unless you have tried other relevant signals or unless you know what the consequences of not allowing that process to terminate cleanly are and they are acceptable. Commented Feb 17, 2012 at 12:30
  • 1
    Yes absolutely. You should not hesitate to edit the answer and improve it.
    – rahmu
    Commented Feb 17, 2012 at 14:13

As it seems that this iperf process is not responding to your "termination" signal (the default signal sendby a kill <pid> command). It usually means that the process is crashed somehow or stuck in input/output accessing.

You just need to be more violent and send a "KILL" signal:

kill -9 <pid>


kill -KILL <pid>

This will terminate the process without waiting for it to properly finish.

  • 1
    If I'm not mistaken, if the process is stuck in I/O, then even kill -9 will not kill it.
    – bbaja42
    Commented Feb 17, 2012 at 10:10
  • You are right, so stuck on input/output ... not real I/O ;)
    – Ouki
    Commented Feb 17, 2012 at 10:27

Although generally not recommended, you can always resort to kill -9 <pid> to really kill a process. Do understand, however, that you are forcefully shutting the process down, meaning that it will not gracefully exit.


use kill -9 <pid of iperf> to kill the process. With a signal number of 9 (KILL), the kill cannot be caught by the process; use this to kill a process that a plain kill doesn't terminate.


You can stop an iperf3 started in daemon mode with the -D option by sending it a SIGHUP signal (signal number 1 as suggested in rahmu's answer) :

pkill -HUP iperf3


pkill -1 iperf3

You should use the kill command with -9 option.

$ kill -9 pid

I sends the SIGKILL signal to kill the process which is the strongest signal of all.


you can use svc command which is used to stop the daemon services

  • 3
    on ... Solaris 11, maybe? The Q isn't specifically tagged to an OS, so you could maybe qualify which OS's your answer applies to.
    – Jeff Schaller
    Commented Apr 20, 2018 at 15:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .