5 Advanced Archive Tools for Linux Command Line – Part 2

In our previous article, we explored the top 5 command line archive tools, including tar, shar, ar, cpio, and gzip.

In this follow-up, we will cover 5 more archiving and compression utilities that are useful for various scenarios, along with their features, options, and practical examples.

6. bzip2 Command

bzip2 is a file compression tool that uses the Burrows-Wheeler algorithm and Run-Length Encoding (RLE) to achieve higher compression ratios than gzip and it produces compressed files with an .bz2 extension.

bzip2 Options:

  • -d : Decompress a file.
  • -z : Compress a file (default behavior).
  • -k : Keep the original file while compressing.
  • -f : Force overwrites if the output file exists.

Compress a file:

bzip2 filename.txt

Decompress a .bz2 file:

bzip2 -d filename.txt.bz2

Compress a file and retain the original:

bzip2 -k filename.txt

7. xz Command

xz is another popular file compression utility that uses the LZMA2 algorithm, offering better compression ratios than gzip and bzip2 for larger files and it produces .xz compressed files.

xz Options:

  • -d : Decompress a file.
  • -k : Keep the original file after compression.
  • -z : Compress a file (default behavior).
  • -f : Force overwrites of existing files.

Compress a file:

xz filename.txt

Decompress an .xz file:

xz -d filename.txt.xz

Compress a file and keep the original:

xz -k filename.txt

8. zip Command

zip is one of the most common file archiving utilities that compresses files into a single .zip archive and it is widely used for cross-platform file sharing.

zip Options:

  • -r : Recursively archive directory contents.
  • -u : Update the archive with new files.
  • -d : Delete specified files from the archive.
  • -m : Move files into the archive and delete the originals.

Create a zip archive:

zip archive_name.zip file1 file2 file3

Compress a directory recursively:

zip -r archive_name.zip /path/to/directory

Extract a zip archive:

unzip archive_name.zip

9. rar Command

rar is a proprietary archiving utility that is widely used for compressing large files and it supports password-protected archives and multi-volume archives.

rar Options:

  • a : Add files to the archive.
  • x : Extract files from the archive.
  • v : Create multi-volume archives.
  • p : Set a password for the archive.

Create a rar archive:

rar a archive_name.rar file1 file2

Extract a rar archive:

rar x archive_name.rar

Create a password-protected rar archive:

rar a -p archive_name.rar file1 file2

10. 7zip Command (7z)

7z is a high-compression utility that uses the LZMA algorithm to create .7z files and it provides better compression than most other utilities.

7z Options:

  • a : Add files to an archive.
  • x : Extract files from an archive.
  • l : List the contents of an archive.
  • d : Delete a file from the archive.

Create a 7z archive:

7z a archive_name.7z file1 file2

Extract a 7z archive:

7z x archive_name.7z
Conclusion

With these additional tools, you now have a comprehensive arsenal of archiving and compression utilities to handle any file compression task on Linux. Each tool has its strengths and use cases, so choose the one that best fits your needs.

Stay tuned for more tutorials and tips on Tecmint, and feel free to share your feedback in the comments section below!

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

Ravi Saive
I am an experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.