Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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'm trying to compress only two files in a directory. Let's say I have a directory named 'images'. In the directory, I have a.jpg, b.jpg, c.jpg, and d.jpg. I like to compress only a.jpg and b.jpg using tar.

I googled about it, but weirdly I could not find it!

share|improve this question
found out: tar cvfz file.tar.gz a.jpg b.jpg – user45326 Jun 20 '11 at 8:38
up vote 5 down vote accepted


tar cvf output.tar images/{a,b}.jpg


share|improve this answer

Your Answer


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

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