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
An archive containing Tar files compressed with Bzip2 is referred to as an bz2 file. The process of extracting tar. If the tar -XF command precedes your archive name, it will work. how do i create a tar file in linux? how do i compress a tar bz2 file in linux? how do i create a tar file? how do i unzar a bz2 file in linux?
The general form of the command for creating tar.gz files is as follows: tar -czf archive-name.tar.gz file-name... Here’s what the command options mean: -c - instructs tar to create a new archive. -z - sets the compression method to gzip. -f archive-name.tar.gz - specifies the archive name.
Creating Tar Bz2 Archive Another popular algorithm for compressing tar files is bzip2. When using bzip2, the archive name should end with either tar.bz2 or tbz. To compress the archive with the bzip2 algorithm, invoke tar with the -j option.
The archive is piped to gzip, which compress and write the archive to the disk. Create a tar.gz file from all “.jpg” files: The wildcard character ( *) means all files that end with “.jpg” extension. Create a tar.gz file, transfer it over ssh and extract it on the remote machine: tar.gz file is a Tar archive compressed with Gzip.
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 *
Cheers!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With