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!

Two small things before you go

If something didn’t work on your setup, leave a comment and tell me which distro and version you’re on. I read every one, and most of these articles got better because a reader pointed out what was missing.

And if it did work, share it. TecMint has stayed free for 14 years because people pass these articles around, and that traffic is what pays for writing the next one.

Leave a comment
Get two free Linux courses

Learn the Linux basics with two free courses and join 34,000+ readers getting practical TecMint tutorials and selected Pro TecMint articles every week.

Pro TecMint
Get lifetime access for $99

If you want to go beyond the free tutorials, Pro gives you 18 courses, 5 ebooks, and every future course I add. One payment, lifetime access, no renewals.

Ravi Saive
Ravi Saive
Administrator
About the author

I'm Ravi Saive, an award-winning entrepreneur and founder of several successful 5-figure online businesses, including TecMint.com, GeeksMint.com, UbuntuMint.com, and the premium learning hub Pro.Tecmint.com.

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.