4 Archiving Tools for Linux Server Admins - page 2
tar and zip
gzip does file compression/decompression, but not archiving. However, it works well when used together with an archiving tool - in particular, gzip and tar play nicely together.
- gzip file.tar
compresses file.tar to create file.tar.gz.
- tar czf file.tar.gz mydir/
archives and compresses mydir/ to create file.tar.gz
- gunzip file.tar.gz or gzip -d file.tar.gz
- tar zxf file.tar.gz
uncompress file.tar.gz and also unpack the archive.
Note that you can also use gzcat (use exactly as gunzip) to decompress directly to standard output.
bzip2, like gzip, does compression but not archiving. Again, it works well with tar if you want both archiving and compression. It compresses better than gzip, but the cost of that is that it takes longer to run.
It uses a series of stacked transforms to compress data, the most important of which is the Burrows-Wheeler transform. This reorders blocks to maximise the number of repeated symbols. Runs of repeated symbols can then be replaced by the symbol and a code which represents the length of the run, reducing the size taken up by each run. The Huffman coding used in DEFLATE (where common symbols are swapped in for shorter versions of them) is also used after that, to reduce the space still further, along with a couple of other more minor changes. Given all of that, the time it takes is hardly surprising!
- bzip2 file.tar
compresses file.tar to create file.tar.bz2.
- bunzip2 file.tbz
uncompresses file.tbz to create file.tar.
- tar jxf file.tbz
uncompresses file.tbz and unpacks the archive.
Note that you can also use bzcat to decompress directly to standard output.
If you're interested in compression algorithms, you could also check out 7-zip (the Linux command-line version is p7zip), which implements the LZM algorithm. In most cases it compresses better than bzip2, and it also decompresses faster (although it compresses slower). However, it's much less popular (I've never seen it in the wild).
Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.
- 1Linux Top 3: GNOME 3.12 and New Betas for Ubuntu 14.04 and OpenMandriva Lx 2014.0
- 2Linux Top 3: Linus Lashes out, Linux 3.14 Gets PIE and Ubuntu One is Done.
- 3Linux Top 3: Ubuntu 14.04, Debian Gives Squeeze More Life and Red Hat Goes Atomic
- 4Linux Top 3: RHEL 6.5, Debian 7.2 and EOL for Linux 3.0.x
- 5Linux Top 3: CoreOS, Oracle Enterprise Linux 7 and Ubuntu 14.10