Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The article Encrypting a tar file using openssl has the following line:

tar cvj ~/Projects/arc/ | openssl smime -encrypt -aes256 -binary -outform DEM public.pem | dd of=arc.bckp

we can use cat instead of dd at the end... but should we? which one is better to be used here - cat or dd? and why?

I've 'time'-ed both options and can't see any significant advantage...


share|improve this question

migrated from Nov 2 '12 at 8:11

This question came from our site for professional and enthusiast programmers.

I wonder why using dd here – Tim Green Nov 2 '12 at 5:37
that's how I found it here: encrypting tar file using openssl... I also wonder why :) – Yordan Radunchev Nov 2 '12 at 5:40
up vote 7 down vote accepted

Neither cat nor dd needs to be used; just say

tar cvj ~/Projects/arc/ | openssl smime -encrypt -aes256 -binary -outform DEM public.pem > arc.bckp
share|improve this answer
yep. it works that way too... :) thank you! – Yordan Radunchev Nov 2 '12 at 5:45

Only advantage you would get using dd is, "progress" can be displayed by sending SIGUSR1.

Else you can simply redirect. As said by jwpat7, no need to cat either.

One plus point of using dd instead of simple redirect is that you can easily sudo dd if required. That is not possible for redirection.

share|improve this answer
True. I will remember that. But as I intend to use it in a cron job it's better without 'progress' :) – Yordan Radunchev Nov 2 '12 at 6:04
progress is what pv is for – Nanzikambe Sep 25 '13 at 19:38
Yes, but pv will continuously keep putting progress information on stderr. If you want it to be only on-demand basis, then dd is an option. – anishsane Sep 26 '13 at 7:33

You must log in to answer this question.

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