-3

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

2
  • bzip2 sample.txt
    – suspectus
    Jul 30, 2013 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. Jun 17, 2015 at 23:20

1 Answer 1

8

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.

You must log in to answer this question.

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