Create Compress Archive Almost Any File in Linux (tar, tar.gz, tar.bz2, gz, bz, zip, 7z, rar, etc…)

Article By: yang-li


Compress file Command's like rar, tar, unzip, zip on a VPS Server

This is a Linux command line guide/cheat sheet that will help you archive or compress file. More options are also available by reading the man pages!

Most compression or archiving methods that you may want are already built into popular distributions (Ubuntu, Fedora, Suse, etc…), but some of them aren’t.

I would recommend installing this group of packages using apt-get, yum, or an equivalent before using this guide (unless of course you already know what you need):

KB Knowledge Base - compress file - VPS server hosting at BIPmedia
su -c 'yum install unzip zip p7zip rar unrar bzip2 gzip lzma'


.tar Command

tar cvf filename.tar /dir


tar czvf filename.tar.gz /dir


tar cvzf filename.tgz /dir


You probably mean .tar.bz2

tar cjvf /dir


tar cjvf filename.tbz /dir


tar cjvf filename.tar.bz2 /dir

.tar.Z .Z is an old naming convention which has moved to .gz. See .tar.gz above. .tar.xz

tar cvf -  filenames | lzma > filename.tar.xz 


gzip filename


bzip filenameCreate Compress Archive


bzip2 filename


lzma filename


zip -r /dir


7z a -t7z filename.7z /dir


rar a filename.rar /dir

.dd Create these image files using:

dd if=inputfile.dd of=outputfile.dd

Have more to share? I would love to hear about it in the comments section below. Also, If you're having any trouble, let me know about it in the comments. We’ll get you straightened out.

Tags: , , , , , , , , , , , ,

Welcome to the healthcare-only HIPAA - GDPR compliant cloud. Exclusively hosted on a HPC environment!

Learn more or start today by choosing your secure HIPAA - GDPR compliant server's Operating System bellow and pick the package that's best for you.

BIPmd makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine, thousand or more.

Windows VPS options and add ons
Linux VPS options and add ons


Looking for a custom solution?

Our technicians can provide you with the best custom-made solutionss on the market, no matter whether you're a small business or large enterprise.

Get in touch

Leave a Reply


Spark Book Company

Posted on June 5, 2018


Amitabh Singh

Posted on June 5, 2018

This is the first tutorial feedback test.