Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

I have some large files that I need to change the compression type of for input to a program--I need to unrar them and then gzip (or bzip2) them. However, they're highly compressed files and I don't have the disk space to unrar them fully then gzip them. Is there any way to pipe the output of decompression via unrar to gzip or some other compression without saving the entire intermediate result to disk?

share|improve this question

migrated from stackoverflow.com Oct 28 '12 at 23:02

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

man unrar mentions an option p: "Print file to stdout". So, it seems you might extract the file with unrar and pipe it to gzip/bzip2.

share|improve this answer
There's garbage data: echo jj > a; rar a a.rar a; unrar p a.rar | gzip -9 -f > out.gz; zcat out.gz – warl0ck Oct 29 '12 at 0:07
@warl0ck Yes, add -ierr to suppress informational messages. Look at man unrar – Olaf Dietsche Oct 29 '12 at 6:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.