Linux/Unix: How To Extract and Decompress a .bz2/.tbz2 File

Linux/Unix: How To Extract and Decompress a .bz2/.tbz2 File

To extract and decompress a .bz2 or .tbz2 file in Linux or Unix, you can use the bzip2 command.

To extract a .bz2 file, use the -d flag to decompress the file and the -k flag to keep the original file:

bzip2 -dk file.bz2
So‮.www:ecru‬lautturi.com

To extract a .tbz2 file, use the -x flag to extract the file and the -k flag to keep the original file:

bzip2 -xk file.tbz2

Both of these commands will decompress the .bz2 or .tbz2 file and create a new file with the same name as the original file, but without the .bz2 or .tbz2 extension.

Alternatively, you can use the tar command to extract and decompress a .tbz2 file. The tar command is used to create and manipulate tar archives, and it can be used with the bzip2 command to extract and decompress .tbz2 files.

To extract a .tbz2 file using tar, use the -xjf flags to extract and decompress the file:

tar -xjf file.tbz2

This will extract and decompress the .tbz2 file and create a new directory with the same name as the .tbz2 file, containing the contents of the file.

By using the bzip2 or tar command, you can easily extract and decompress .bz2 and .tbz2 files in Linux or Unix.

Created Time:2017-10-30 10:17:49  Author:lautturi