gzip Compress a directory (folder)

visibility 467 access_time 11 months ago languageEnglish timeline Stats
timeline Stats
Page index 1.46
more_horiz

This code snippet shows how to compress a whole directory or folder using tar command. 

Code snippet

tar -zcvf archive-file-name.tar.gz your-folder/ 

Use man tar to find out the details of the options of the above commands.

  • -z - compress it using the z (gzip) algorithm
  • -c - (create) an archive from the files in directory
  • -v - (verbosely) list all the files it adds to the archive
  • -f - store the output as archive-file-name.tar.gz

To unzip it, using the command below:

tar -zxvf archive-file-name.tar.gz

References

Can I zip an entire folder using gzip? - Unix & Linux Stack Exchange

copyright This page is subject to Site terms.
Like this article?
Share on

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

More from Kontext
Check HDFS folder size in Shell / Hadoop
visibility 1,146
thumb_up 0
access_time 3 years ago
Export CSV File from Azure SQL Databases
visibility 1,370
thumb_up 0
access_time 11 months ago
List and kill jobs in Shell / Hadoop
visibility 389
thumb_up 0
access_time 4 years ago