Back to Homepage
Tuesday 27 February 2024
24

How to Compress a Folder with Tar

Using the tar Command

In Unix-like operating systems, the tar command is commonly used to archive and compress files and directories.

To compress a folder with tar, you can use the following command:

tar -czvf archive.tar.gz folder/

This command creates a compressed tarball named archive.tar.gz containing all the files and subdirectories within the folder directory.

Here's a breakdown of the options used:

-c: Create a new archive -z: Compress the archive using gzip -v: Verbose mode (show progress) -f: Specify the archive file name

You can replace folder/ with the path to the folder you want to compress.

Share:
Created by:
Author photo

Jorge García

Fullstack developer