I compressed a folder with many subfolders ( about 50GB)
Compression:
tar -cjf test.tar.bz2 test
unzip:
lbzip2 -k -d -n 5 test.tar.bz2 ~/temp/
Why the output is a .tar file ? I'm searching on google but I'm confused I expect a uncompressed folder
Thank you
CodePudding user response:
These might help:
# Compress a folder with many subfolders and files.
function compress() {
# Get the name of the folder to compress.
echo "Enter the name of the folder to compress:"
read folder
# Get the name of the compressed file.
echo "Enter the name of the compressed file:"
read file
# Compress the folder.
tar -czf $file $folder
}
# Decompress a tar file into a folder using lbzip2.
function decompress() {
# Get the name of the file to decompress.
echo "Enter the name of the file to decompress:"
read file
# Get the name of the folder to decompress into.
echo "Enter the name of the folder to decompress into:"
read folder
# Decompress the file.
lbzip2 -d $file
# Extract the file.
tar -xzf $file -C $folder
}
CodePudding user response:
tar -xjf test.tar.bz2
That will run bunzip2
to decompress and it will extract the contents of the tar file.
If you feel the need to specifically use lbzip2
for decompression, then:
lbzip2 -dc < test.tar.bz2 | tar xf -