5

I started a rather long dd command that I would like to stop.

ps shows:

$ ps
  PID TTY           TIME CMD
 2006 ttys002    0:00.00 (dd)

The dd process is shown in parenthesis without the argument.

A kill produces no effect. Any idea on how to interrupt it?

  • 1
    Sure: directly in the shell dd if=/dev/urandom of=somefile size=... – Matteo Jan 26 '16 at 12:04
6

The actual display of a process between (…) means this process was detached from its controlling terminal (here ttys002). This means that ^C, ^\, ^S, ^Z don't have anymore effect on it. It's behaving in daemon mode. This also means you can't send it a hangup either.

The correct way to deal with this case if unwanted, is to get the number of its parent process with:

ps lw | egrep '[ ](2006|PID)'

and kill it with a hangup signal:

kill -HUP xxxx

where xxxx is the process ID of the parent process.

2

This is a zombie process. Here's how to get rid of it from this answer on superuser:

Sadly, it appears that killing of zombies is all about killing the parent, and if the parent is /sbin/launchd, you can kill it only with rebooting.

It would be a Very Bad Idea to kill launchd, but you can tell it to HUP.

Try sudo kill -s HUP 1

That will cause launchd to reinitialize without restarting. This has worked for me in the past (wrt. removing zombie entries).

  • 1
    Are you sure? Zombie processes should be marked with a Z and in this case the dd process finished and was removed in the process table, – Matteo Jan 26 '16 at 10:18
  • 1
    What does ps aux shows in STAT column? – Mateusz Szlosek Jan 26 '16 at 10:20
  • 1
    The process finished after one hour (and produced the correct output) and I cannot check anymore ... – Matteo Jan 26 '16 at 10:21
  • 1
    I don't know the other reason why process could not be killed and is shown in parenthesis in ps command. Maybe someone else have a clue. – Mateusz Szlosek Jan 26 '16 at 10:27
  • 2
    @Mateusz: this wasn't a zombie, this was a daemon, and I won't be able to help understand why. – dan Jan 26 '16 at 12:02

You must log in to answer this question.

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