This is a no-frills Linux command line guide/cheat sheet that will help you archive or compress just about any file that you’re bound to come across. If you’d like to have more options, read the man pages! Also, the opposite to this guide about extracting/uncompressing/unarchiving files in Linux can be found here.
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
yum, or an equivalent before using this guide (unless of course you already know what you need):
su -c 'yum install unzip zip p7zip rar unrar bzip2 gzip lzma'
tar cvf filename.tar /dir
tar czvf filename.tar.gz /dir
tar cvzf filename.tgz /dir
You probably mean .tar.bz2
tar cjvf filename.tar.bz /dir
tar cjvf filename.tbz /dir
tar cjvf filename.tar.bz2 /dir
.Z is an old naming convention which has moved to .gz. See .tar.gz above.
tar cvf - filenames | lzma > filename.tar.xz
You probably mean .bz2
.Z is an old naming convention which has moved to .gz. See .gz above.
zip -r filename.zip /dir
7z a -t7z filename.7z /dir
rar a filename.rar /dir
This is a bit more complicated than what I have time for. Looks like somebody has already figured something out.
Create these image files using:
dd if=inputfile.dd of=outputfile.dd
Have more to share? I wouldn’t mind hearing about it in the comments if you do!
Let me know about it in the comments. We’ll get it straightened out.