Compress file Command’s

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

compress file
su -c 'yum install unzip zip p7zip rar unrar bzip2 gzip lzma'

Command’s

.tar

tar cvf filename.tar /dir

.tar.gz

tar czvf filename.tar.gz /dir

.tgz

tar cvzf filename.tgz /dir

.tar.gz2

You probably mean .tar.bz2

.tar.bz

tar cjvf filename.tar.bz /dir

.tbz

tar cjvf filename.tbz /dir

.tar.bz2

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 

.gz

gzip filename

.bz

bzip filenameCreate Compress Archive

.bz2

bzip2 filename

.xz

lzma filename

.zip

zip -r filename.zip /dir

.7z

7z a -t7z filename.7z /dir

.rar

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 cloud server in no time flat

Simple setup. Full root access. Straightforward pricing.


DEPLOY SERVER




Leave a Reply