Pression
Pression
System
Administrator
Compressing and
Decompressing Files
Compression and Archives
There are two topics we need to
cover:
Compression
• Encoding information in fewer bits
than the original information
Archive
• A file that is a collection of a number
of files/directories that can be sorted
easier than its components
Archives
The most common archive
command is tar.
tar stands for, and was originally
used for “Tape Archive”.
Creating an archive:
tar cvf home.tar /home
• create an archive
• verbose
• file name
Extracting an archive:
tar xvf home.tar
• extract an archive
• verbose
• file name
Compression
There are two main compression
commands: gzip and bzip2. They
both do essentially the same thing,
but they use different compression
algorithms.
gzip example:
gzip bigfile.stuff
gzip –d bigfile.stuff.gz
bzip2 example:
bzip2 bigfile.stuff
bzip2 –d bigfile.stuff.bz2
Compress an Archive
While you can compress any file,
you can also just compress an
archive when you create it:
tar czvf home.tar.gz /home
or:
tar cvjf home.tar.bz2 /home