You are on page 1of 10

Module 7

Archiving and
Compression

This slide deck is for LPI Academy instructors to use for lectures for LPI Academy courses.
Copyright Network Development Group 2013.
Exam Objective
3.1 Archiving Files on the Command Line

Objective Summary
Using archiving and compression with
files and directories

This slide deck is for LPI Academy instructors to use for lectures for LPI Academy courses.
Copyright Network Development Group 2013.
Archiving and
Compression

This slide deck is for LPI Academy instructors to use for lectures for LPI Academy courses.
Copyright Network Development Group 2013.
Archiving vs. Compression
Archiving collapses multiple files into
one
A few files or multiple directories

Compression makes a file smaller


Remove redundant information, replace
with a smaller code
Can be applied to individual files, groups
of files or entire directory trees
This slide deck is for LPI Academy instructors to use for lectures for LPI Academy courses.
Copyright Network Development Group 2013.
Uses of Archiving and Compression

Managing log files


Sharing groups of files
Project documents
Source code
Compressing for more efficient
transfer
Less data to send over the Internet or to
tape
Keep like files together grouped by
time
This slide deck is for LPI Academy instructors to use for lectures for LPI Academy courses.
Copyright Network Development Group 2013.
Lossless vs Lossy
Compression
Lossless: Lossy:
Decompressed file is Decompressed file
the same as the might have lost
original information from the
Doesnt compress as original
well as lossy Drops unimportant
For data you want to information from the
preserve file to make it
Logs, documents, compress better
binaries, configuration Images, sound,
movies
This slide deck is for LPI Academy instructors to use for lectures for LPI Academy courses.
Copyright Network Development Group 2013.
gzip vs bzip2
gzip and gunzip Bzip2 and bunzip2
Uses Lempel-Ziv Burrows-Wheeler
coding block sorting
Lossless Lossless
compression, good compression,
efficiency slightly more
efficient than gzip,
but requires more
CPU
Used almost
identically as gzip
This slide deck is for LPI Academy instructors to use for lectures for LPI Academy courses.
Copyright Network Development Group 2013.
Using
gzip/gunzip/bzip2/bunzip2
gzip foo # removes foo; creates foo.gz
gunzip foo.gz # removes foo.gz; creates foo
gunzip l foo.gz # shows statistics

bzip2 foo # removes foo; creates


foo.bz2
bunzip2 foo.bz2
bunzip2 l foo.bz2 # DOESNT EXIST!

This slide deck is for LPI Academy instructors to use for lectures for LPI Academy courses.
Copyright Network Development Group 2013.
Tape Archive - TAR
tar cf foo.tar * # create
tar tf foo.tar # show info
tar xf foo.tar # extract

tar czf foo.tgz * # gzip


tar xjf foo.tbz # bunzip2

tar xf foo.tar home/joe


# only extract home/joe
This slide deck is for LPI Academy instructors to use for lectures for LPI Academy courses.
Copyright Network Development Group 2013.
ZIP
zip output.zip file1 file2 file3
zip foo.zip file.doc # One file
zip r foo.zip Documents # recurse

unzip l foo.zip # show contents


unzip foo.zip # extract all
unzip foo.zip file1 # just file 1
unzip foo.zip Documents/projectA/*
# everything under Documents/projectA

This slide deck is for LPI Academy instructors to use for lectures for LPI Academy courses.
Copyright Network Development Group 2013.