How to compress files while using linux terminal with tar via ssh ?

You can use tar:

“tar -zcvf archive.tar.gz folder/”

-z: Compress with gzip

-c: Create archive

-v: Display progress

-f: filename

For extracting archive:
“tar -zxvf archive.tar.gz -C /extractionpoint”


For more detailed info:

-C Directory Causes the tar command to perform a chdir subroutine to the directory specified by the Directory variable. Using the -C flag allows multiple directories not related by a close common parent to be archived, using short relative path names. For example, to archive files from the /usr/include and /etc directories, you might use the following command:

tar -C 


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s