Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Maybe i'm confused, but doesn't tar just gather everything into one file, then gzip zips that one tar'd file? couldn't you just gzip whatever files/directories you want directly? or am i thinking to Windows-ey haha
Maybe i'm confused, but doesn't tar just gather everything into one file, then gzip zips that one tar'd file? couldn't you just gzip whatever files/directories you want directly? or am i thinking to Windows-ey haha
I don't think gzip will preserve the directory structure intact. Most of the tarballs that I've seen have fairly elaborate structure that needs to be preserved.
Cheers,
jdk
gzip only works on single files. If you wanted to generate an archive of an entire directory structure, you'd only be able to generate individual gzipped files. tar groups the directory structure into a single file, then gzip compresses that single file.
Creating a compressed tarball of a single file is a redundant measure, you could just gzip the single file and remove the tar overhead.
What are everyone's preferences regarding using gzip and bzip2?
There has to be a difference and one is going to have a better compression ratio... perhaps on certain filetypes?
Bear in mind that both gzip http://linux.die.net/man/1/gzip
and bzip2 http://linux.die.net/man/1/bzip2
have compression vs speed options, expressed as a num 1-9, so its best to read those links and test if you really want to know. The general assumption (which may be wrong) is that the default(!) settings are such that gzip tends to be quicker, but bzip2 tends to compress better ... your choice & YMMV.
I once experimented, zero'ing out free space on a partition (/boot) and piping the output of dd through bzip2 and gzip. I was surprised that in this test, the gzip'ed image backup was smaller, but not by much. The only way to know for sure is to run test experiments yourself.
What are everyone's preferences regarding using gzip and bzip2?
There has to be a difference and one is going to have a better compression ratio... perhaps on certain filetypes?
At least on the size of files I'm normally working with, any differences are negligible. By force of habit I stick with gzip.
$ tar cfz ... is easier for me to remember than $ tar cfj ...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.