A tar.bz2 file is a bzip2-compressed tar archive, which is a popular file format used in the Linux environment. It is typically used when a higher compression rate is desired at the cost of additional CPU processing time. This file format is an alternative to the more common tar.gz format, offering better compression but at the expense of increased resource usage during the compression and decompression processes.
tar.bz2 archive files can be extracted using the tar command-line utility, which is installed by default in most Linux distributions.
Related: How to extract tar.gz files in Linux
Steps to extract bzip2-compressed tar archive in Linux:
- Open your preferred terminal application.
- Verify if the file is a valid bzip2 archive (optional).
$ file file.tar.bz2 file.tar.bz2: bzip2 compressed data, block size = 900k
- Create a folder to store the extracted files (optional).
$ mkdir destination
- Navigate to the desired directory where the files will be unpacked (optional).
cd destination/
- Use the tar command to extract the files.
$ tar --extract --bzip2 --verbose --file=/home/user/file.tar.bz2 #Simplified version: tar -xjvf /home/user/archive.tar.gz archive/ archive/subfolder-02/ archive/subfolder-02/filename-02 archive/subfolder-02/filename-01 archive/subfolder-01/ archive/subfolder-01/filename-02 archive/subfolder-01/filename-01
- View the contents of the extracted files.
$ ls -R .: archive ./archive: subfolder-01 subfolder-02 ./archive/subfolder-01: filename-01 filename-02 ./archive/subfolder-02: filename-01 filename-02
Author: Mohd
Shakir Zakaria
Mohd Shakir Zakaria is an experienced cloud architect with a strong development and open-source advocacy background. He boasts multiple certifications in AWS, Red Hat, VMware, ITIL, and Linux, underscoring his expertise in cloud architecture and system administration.
Mohd Shakir Zakaria is an experienced cloud architect with a strong development and open-source advocacy background. He boasts multiple certifications in AWS, Red Hat, VMware, ITIL, and Linux, underscoring his expertise in cloud architecture and system administration.
Discuss the article:
Comment anonymously. Login not required.