Compress an entire directory using “tar” command

tar -zcvf archive-name.tar.gz dir-name

z – indicates that it will compress using gzip format

c – is to create the new archive

v – display progress

f – is file name to be used (so “archive-name.tar.gz” is the name of the archive you have to use)

dir-name – is the name of directory you want to compress


So for example it could be something like:

tar -website.tld.tar.gz .

(this will compress also hidden files)


tar -zcvf archive-name.tar.gz /home/usr/web/website.tld/public_html/


Posted in Miscellaneous.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.