Create .tar.bz2 File in Linux

Last updated on Dec 28, 2019 in Linux

When you create a .tar.bz2 file, you most likely want to have an entire folder compressed. This is easy by using tar utility with bzip2 compression.

Let’s assume that your folder is folder. Enter thefollowing command in Linux terminal:

$ tar -jcvf folder.tar.gz folder/
  • j stands for bzip2 compression method
  • c creates a new archive file
  • v means verbose output
  • f we specify the new filename as a next argument

To view the contents of the new folder.tar.bz2, just type:

$ tar -tf folder.tar.bz2

This should output a list of files in this archive.