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

How can I convert a sample.txt (uncompressed) file to sample.tar.bz2 format using Ubuntu 10.04 command shell?

share|improve this question
bzip2 sample.txt – suspectus Jul 30 '13 at 9:11
bzip2 -c sample.txt > sample.txt.bz2 @suspectus straight up would delete the original file, (which could be in use!) and print to stdout, not file. – Luke Stanley Jun 17 '15 at 23:20
up vote 7 down vote accepted

You can use tar to achieve this :

tar -cjf sample.tar.bz2 sample.txt

tar is a program used to manage archives, the options here are -c to create an archive (it would be -xto extract one), -j to use .tar.bz2 format, and -f to specify output archive name.

For more info : man tar.

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.