Commands.page Logo

How to Compress a Directory Using LZMA in Ubuntu

This article provides a concise guide on compressing directories within the Ubuntu operating system using LZMA compression. It outlines the necessary terminal command to archive and compress a folder efficiently while explaining the required flags for successful execution.

To compress a directory using LZMA in Ubuntu, you must use the tar command because the LZMA utility itself does not handle directories directly. Open your terminal and navigate to the parent folder of the directory you wish to compress. Run the following command:

tar --lzma -cf archive_name.tar.lzma directory_name

In this command, the --lzma flag specifies the compression method, -c creates a new archive, and -f defines the filename. Replace archive_name.tar.lzma with your desired output file name and directory_name with the actual folder you want to compress. To decompress the file later, use the command tar --lzma -xf archive_name.tar.lzma.