14

I am using dd to do a network transfer of a disk image to an sd card on my BeagleBone.

Using pkill -USR1 -n -x dd in an ssh connection to this BeagleBone gives me a status update of the transfer process, which is great. I am just curious how it is actually working so I can use it effectively in the future.

After reading man pkill it still didn't totally explain how pkill -USR1 -n -x dd is working to give me this very useful status update.

17

This is behavior specific to dd. From the dd man page:

Sending a USR1 signal to a running 'dd' process makes it print I/O statistics to standard error and then resume copying.

$ dd if=/dev/zero of=/dev/null& pid=$!
$ kill -USR1 $pid; sleep 1; kill $pid

18335302+0 records in 18335302+0 records out 9387674624 bytes (9.4 GB) copied,  34.6279  seconds, 271 MB/s

-USR1 tells pkill to send the USR1 signal. -n and -x are just filters to make sure you send to the right process (-n sends to the newest process and -x means the process must be named exactly dd)

  • 2
    This is only in the GNU version of 'dd' (AFAIK). A SIGUSR1 to 'dd' for other OSes (eg AIX, HP-UX & Solaris) will terminate the process, by default. – user14755 Oct 20 '14 at 8:02
  • @DarkHeart use SIGINFO (or INFO) on osx (probably the same on bsd) – akhan Oct 13 '16 at 18:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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