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: , , , , , , , , , , , ,

Spin Up A VPS Server In No Time Flat

Simple Setup

Full Root Access

Straightforward Pricing


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.