Compressing Files

Options for Compressing Files in Linux

Tar

Tar is a command line tool that is used to compress and uncompress files. It is a good choice for beginners as it is easy to use and has a simple interface.

To compress a file using tar, use the following command:

tar -czvf filename.tar.gz filename

To uncompress a file using tar, use the following command:

tar -xzvf filename.tar.gz

Zip

Zip is a command line tool that is used to compress and uncompress files. It is a good choice for beginners as it is easy to use and has a simple interface.

To compress a file using zip, use the following command:

zip filename.zip filename

To uncompress a file using zip, use the following command:

unzip filename.zip

Gzip

Gzip is a command line tool that is used to compress and uncompress files. It is a good choice for more advanced users as it has a steeper learning curve than tar and zip.

To compress a file using gzip, use the following command:

gzip filename

To uncompress a file using gzip, use the following command:

gunzip filename.gz

Bzip2

Bzip2 is a command line tool that is used to compress and uncompress files. It is a good choice for more advanced users as it has a steeper learning curve than tar and zip.

To compress a file using bzip2, use the following command:

bzip2 filename

To uncompress a file using bzip2, use the following command:

bunzip2 filename.bz2

Xz

Xz is a command line tool that is used to compress and uncompress files. It is a good choice for more advanced users as it has a steeper learning curve than tar and zip.

To compress a file using xz, use the following command:

xz filename

To uncompress a file using xz, use the following command:

unxz filename.xz

7z

7z is a command line tool that is used to compress and uncompress files. It is a good choice for more advanced users as it has a steeper learning curve than tar and zip.

To compress a file using 7z, use the following command:

7z a filename.7z filename

To uncompress a file using 7z, use the following command:

7z x filename.7z

Rar

Rar is a command line tool that is used to compress and uncompress files. It is a good choice for more advanced users as it has a steeper learning curve than tar and zip.

To compress a file using rar, use the following command:

rar a filename.rar filename

To uncompress a file using rar, use the following command:

rar x filename.rar

Unrar

Unrar is a command line tool that is used to compress and uncompress files. It is a good choice for more advanced users as it has a steeper learning curve than tar and zip.

To compress a file using unrar, use the following command:

unrar a filename.rar filename

To uncompress a file using unrar, use the following command:

unrar x filename.rar

Zstd

Zstd is a command line tool that is used to compress and uncompress files. It is a good choice for more advanced users as it has a steeper learning curve than tar and zip.

To compress a file using zstd, use the following command:

zstd filename

To uncompress a file using zstd, use the following command:

unzstd filename.zst