Live data from Hacker News

The Cult of DD

eklitzke.org

131–140 of 178 posts

Re: The Cult of DD

#131

This article is full of Useless Uses of Cat[1] that could just use redirection operators. For instance, cat image.iso | pv >/dev/sdb could be rewritten as pv /dev/sdb A related mistake is the Useless Use of Echo, since any command of the form echo "foo" | bar can be written using here strings as bar or even bar [1] http://porkmail.org/era/unix/award.html

Useless or not, I personally prefer left to right flow.

Re: The Cult of DD

#132

This article is full of Useless Uses of Cat[1] that could just use redirection operators. For instance, cat image.iso | pv >/dev/sdb could be rewritten as pv /dev/sdb A related mistake is the Useless Use of Echo, since any command of the form echo "foo" | bar can be written using here strings as bar or even bar [1] http://porkmail.org/era/unix/award.html

pv can read files directly and give more detailed progress. No stdin redirection is needed.

    pv image.iso >/dev/sdb

Re: The Cult of DD

#133

This article is full of Useless Uses of Cat[1] that could just use redirection operators. For instance, cat image.iso | pv >/dev/sdb could be rewritten as pv /dev/sdb A related mistake is the Useless Use of Echo, since any command of the form echo "foo" | bar can be written using here strings as bar or even bar [1] http://porkmail.org/era/unix/award.html

>pv /dev/sdb

Huh? pv can cat stuff on it's own, and it will be able to make a progress bar based on the filesize

  pv image.img > /dev/sdb

Re: The Cult of DD

#134

This article is full of Useless Uses of Cat[1] that could just use redirection operators. For instance, cat image.iso | pv >/dev/sdb could be rewritten as pv /dev/sdb A related mistake is the Useless Use of Echo, since any command of the form echo "foo" | bar can be written using here strings as bar or even bar [1] http://porkmail.org/era/unix/award.html

>pv /dev/sdb Huh? pv can cat stuff on it's own, and it will be able to make a progress bar based on the filesize pv image.img > /dev/sdb

Okay. I don't actually use pv, so I was just extrapolating from the original post. In any case, cat is definitely the wrong choice.

Re: The Cult of DD

#135

This article is full of Useless Uses of Cat[1] that could just use redirection operators. For instance, cat image.iso | pv >/dev/sdb could be rewritten as pv /dev/sdb A related mistake is the Useless Use of Echo, since any command of the form echo "foo" | bar can be written using here strings as bar or even bar [1] http://porkmail.org/era/unix/award.html

>pv /dev/sdb Huh? pv can cat stuff on it's own, and it will be able to make a progress bar based on the filesize pv image.img > /dev/sdb

So I suppose that the command

    pv  /dev/sdb
would actually need to buffer the complete file, before commencing to write to the device (and showing the progress), which would defeat the whole idea of showing progress.

Re: The Cult of DD

#136

This article is full of Useless Uses of Cat[1] that could just use redirection operators. For instance, cat image.iso | pv >/dev/sdb could be rewritten as pv /dev/sdb A related mistake is the Useless Use of Echo, since any command of the form echo "foo" | bar can be written using here strings as bar or even bar [1] http://porkmail.org/era/unix/award.html

They could! They could be super annoying to read, too. Pipelines make more sense to humans when they always read in the same direction.

In the rare case where the volume of data is large enough to make the efficiency hit noticeable on large machines, rewriting a pipeline to eliminate a leading cat makes sense. In all other cases, it is a premature and unnecessary optimization.

Re: The Cult of DD

#137
post #121
post #107

Earlier quoted context omitted.

I don't know if this works but I believe it doesn't.

It doesn’t. In fact, I would be very careful using subshellsm in general, because it can lead to bugs like this one: ​ http://danwalsh.livejournal.com/74642.html​ .

That link 404s due to some url-encoded garbage at the end. This should work: http://danwalsh.livejournal.com/74642.html

Re: The Cult of DD

#138
post #94

Earlier quoted context omitted.

In this case, opportunity cost was real and even quantifiable.

Anyone who didn't invest $150 back then also missed the opportunity

True, but it feels worse to have had the opportunity in one's hands and thrown it away than never to have touched it at all. That's just how humans work - go figure.

Re: The Cult of DD

#139

Earlier quoted context omitted.

I'm a Linux sysadmin/developer and I've literally never used a Linux GUI.

I want to do this so bad, but the two things that keep me running X are my browser and mpv. Oh, and viewing PDFs.

You might find https://github.com/saitoha/libsixel/blob/master/README.md of interest.

Re: The Cult of DD

#140
dd is for handling blocked data, while cat, redirection and pipelines are completely useless for that, since they are not meant to manipulate blocks of data, but streams. They do not compare (apart from really simple cases where either will do, like copying a file into some other file); this blog posts mainly highlights that neither the author nor many tutorial writers now the difference.
Post reply on HN