Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #181542

Re: Trying to understand man page for dd

From "Thomas Schmitt" <scdbackup@gmx.net>
Newsgroups linux.debian.user
Subject Re: Trying to understand man page for dd
Date 2017-05-28 14:50 +0200
Message-ID <tM5NT-23F-5@gated-at.bofh.it> (permalink)
References <tM51v-1tL-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

Richard Owlett wrote:
> It says in part:
> >     $ dd if=/dev/zero of=/dev/null& pid=$!
> >     $ kill -USR1 $pid; sleep 1; kill $pid
> I think it is trying to tell me what I need to know.

dd is started as background process, busily copying bytes from nowhere
to nowhere:

  dd if=/dev/zero of=/dev/null &

Because of the ampersand "&", the shell prompt comes back immediately
after the command line is interpreted and performed. This line contains
the additional assignment of the new process id number to variable "pid":

  pid=$!

The first command in the second line then sends signal USR1 to the
process that is busily copying bytes in background:

  kill -USR1 $pid

This causes the output lines shown in the example

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

The second command simply waits a second before it ends:

  sleep 1

The third command sends signal TERM to the dd process:

  kill $pid

which causes it to end without message.


In the full documentation at
  https://www.gnu.org/software/coreutils/manual/html_node/dd-invocation.html#dd-invocation
a paragraph near the page end gives a more detailed example:
  "Sending an ‘INFO’ signal (or ‘USR1’ signal where that is unavailable)
   to a running dd process makes it print I/O statistics to standard error
   ...
   # Output stats every second.
   ...
   "

Have a nice day :)

Thomas

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Trying to understand man page for dd Richard Owlett <rowlett@cloud85.net> - 2017-05-28 14:00 +0200
  Re: Trying to understand man page for dd JPlews <jw@plews.org.uk> - 2017-05-28 14:10 +0200
    Re: Trying to understand man page for dd Richard Owlett <rowlett@cloud85.net> - 2017-05-28 14:30 +0200
    Re: Trying to understand man page for dd Ulf Volmer <u.volmer@u-v.de> - 2017-06-02 00:00 +0200
      Re: Trying to understand man page for dd Curt <curty@free.fr> - 2017-06-03 14:00 +0200
  Re: Trying to understand man page for dd The Wanderer <wanderer@fastmail.fm> - 2017-05-28 14:10 +0200
    Re: Trying to understand man page for dd Richard Owlett <rowlett@cloud85.net> - 2017-05-28 14:30 +0200
  Re: Trying to understand man page for dd "Thomas Schmitt" <scdbackup@gmx.net> - 2017-05-28 14:50 +0200
    Re: Trying to understand man page for dd Richard Owlett <rowlett@cloud85.net> - 2017-05-28 15:00 +0200
  Re: Trying to understand man page for dd David <bouncingcats@gmail.com> - 2017-05-29 02:50 +0200
    Re: Trying to understand man page for dd "Thomas Schmitt" <scdbackup@gmx.net> - 2017-05-29 08:30 +0200
      Re: Trying to understand man page for dd Richard Owlett <rowlett@cloud85.net> - 2017-05-29 14:10 +0200
        Re: Trying to understand man page for dd David Wright <deblis@lionunicorn.co.uk> - 2017-05-29 15:40 +0200
          Re: Trying to understand man page for dd Richard Owlett <rowlett@cloud85.net> - 2017-05-29 16:20 +0200
            Re: Trying to understand man page for dd "Thomas Schmitt" <scdbackup@gmx.net> - 2017-05-29 17:20 +0200
            Re: Trying to understand man page for dd David Wright <deblis@lionunicorn.co.uk> - 2017-05-29 17:20 +0200
        Re: Trying to understand man page for dd David <bouncingcats@gmail.com> - 2017-05-30 04:30 +0200
    Re: Trying to understand man page for dd mbroe@oakland.edu - 2017-05-31 15:20 +0200

csiph-web