Create a .tar.bz2 file Linux


On my Linux machine, I wish to create a .tar.bz2 file of a certain folder. Once I place myself in that folder (in the terminal), what do I type in the terminal command line to place the compressed folder in the home directory of my machine?

Let's say I am in the folder /home/user/folder. In the folder "folder" are several files (txt, .c etc). How do I compress that folder of type .tar.bz2 and place it in my /home directory?

In the /home/user/folder, I've tried sudo tar -cvjSf folder.tar.bz2 but get an error:

tar: Cowardly refusing to create an empty archive

This question is tagged with linux compression tar

~ Asked on 2014-04-23 14:10:11

The Best Answer is


You are not indicating what to include in the archive.

Go one level outside your folder and try:

sudo tar -cvjSf folder.tar.bz2 folder

Or from the same folder try

sudo tar -cvjSf folder.tar.bz2 *


~ Answered on 2014-04-23 14:14:59


Try this from different folder:

sudo tar -cvjSf folder.tar.bz2 folder/*

~ Answered on 2015-09-20 19:55:06

Most Viewed Questions: