How to create and extract archives using SSH?

From time to time you might need to create archives for example to backup some files or extra archives and through that SSH this is done much faster.

Every single archive type has its own command for compressing and extracting. Here are some of the most popular:

To extract a ZIP file, you can use:

unzip archive.zip

To extra a TAR file, you can use:

tar -xvf archive.tar

cPanel Hosting from WebhostFace

To extract a tar.gz file, you can use:

tar -zxvf archive.tar.gz

To extra a rar file, you can use:

rar -x archive.rar

One of the most popular archive formats in linux is .tar.gz and we strongly recommend it as well. For compressing files each archive type has its own command as above and here is an example:

tar -zcf archive.tar.gz directory/

was this knowledge base article useful to you