Archive and Compress Files Using bzip2


Archive and Compress Files Using bzip2

bzip2

Working with bzip2 is pretty easy if you're comfortable with gzip, as the creators of bzip2 deliberately made the options and behavior of the new command as similar to its progenitor as possible.

$ ls -l -rw-r--r-- scott scott 1236574 moby-dick.txt $ bzip2 moby-dick.txt $ ls -l -rw-r--r-- scott scott 367248 moby-dick.txt.bz2 


Just like gzip, bzip2 leaves you with just the .bz2 file. The original moby-dick.txt is gone. To keep the original file, use the -c (or --stdout) option and pipe the output to a filename that ends with .bz2.

$ ls -l -rw-r--r-- scott scott 1236574 moby-dick.txt $ bzip2 -c moby-dick.txt > moby-dick.txt.bz2 $ ls -l -rw-r--r-- scott scott 1236574 moby-dick.txt -rw-r--r-- scott scott 367248 moby-dick.txt.bz2 


If you look back at "Archive and Compress Files Using gzip," you'll see that gzip and bzip2 are incredibly similar, which is by design.



Linux Phrasebook
Linux Phrasebook
ISBN: 0672328380
EAN: 2147483647
Year: 2007
Pages: 288

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net