0% found this document useful (0 votes)
75 views

Week 9 - Lect8 - Comp-Decomp

This document discusses digital archiving and compression techniques in Linux. It explains that archiving stores and transfers files to save storage space, while compression makes files smaller. Common compression formats are discussed, such as zip, gzip, bzip2 and tar. Lossless compression eliminates file repetition without data loss, while lossy compression removes some data. The document then demonstrates how to use gzip, bzip2 and tar to compress, archive, decompress and extract files in Linux. It proposes challenges to write scripts to compress, archive and backup files.

Uploaded by

Ghassan Afaneh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views

Week 9 - Lect8 - Comp-Decomp

This document discusses digital archiving and compression techniques in Linux. It explains that archiving stores and transfers files to save storage space, while compression makes files smaller. Common compression formats are discussed, such as zip, gzip, bzip2 and tar. Lossless compression eliminates file repetition without data loss, while lossy compression removes some data. The document then demonstrates how to use gzip, bzip2 and tar to compress, archive, decompress and extract files in Linux. It proposes challenges to write scripts to compress, archive and backup files.

Uploaded by

Ghassan Afaneh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

LINUX

OPERATING SYSTEM I
(CST8207)

Algonquin College

Week9

By: Arsalan Parsaei

LINUX OS_I - BY ARSALAN


UNDERSTANDING DIGITAL ARCHIVING/COMPRESSION
Archive: file & transfer (data) to a storage
Files : ( .iso Linux box ) big file
Compression Technique that makes files smaller in & compressed
size
Voice: mp3 music ,voice recorder,
So what ? phone line VoIP
In production environment, this comes very
handy Recorded Video :

00101000101 Lossless: eliminate repetition | loss amount => 0


11010100101 Lossy: some data is removed | depend on ratio
00100010010
Example:
00101001101
Lossless zip gzip png bmp tiff wav
Lossy: jpg mpeg mp3 mp4

LINUX OS_I - BY ARSALAN


ARCHIVING / COMPRESSION TOOLS

Linux Tools
tar
gzip
bzip2

LINUX OS_I - BY ARSALAN


To compress file “f1” : $ gzip f1 (compress f1 to f1.gz)
To Decompress “f1.gz” : $ gunzip f1.gz (compress f1.gz back to f1)

To compress : $ bzip2 f1 (compress f1 to f1.bz2)


To Decompress: $ gunzip f1.bz2
Ratio: gzip –l *.* or gzip –l f1 shows the
compression ratio for a file or all the file in
current directory
To do file and directory compression and Archiving we use tar utility in Linux

LINUX OS_I - BY ARSALAN


To compress all files/Dirs in current directory => $ tar –zcvf W9.tgz .

LINUX OS_I - BY ARSALAN


COMPRESS/ARCHIVE WITH TAR & VERIFICATION

LINUX OS_I - BY ARSALAN


DECOMPRESSING TAR FILE

LINUX OS_I - BY ARSALAN


CHALLENGE

LINUX OS_I - BY ARSALAN


WRITE A SCRIPT THAT IS….

 Write a script that is called “zipme.sh” to compress all files in current

directory (gzip) and show the ratio of compressed files

 Write a script called “backup.sh” to archive/compress all files/dirs. In

current folder and save it as mybackup.tgz

 Write a script extract mybackup.tgz to new directory call “Restore” in

home directory

LINUX OS_I - BY ARSALAN


WHAT TO DO FOR NEXT WEEK

• Complete Week 9 assignment in this week lab


• Read the Week 9 contents and resources and practice
• Finish Quiz 2 by next lecture

LINUX OS_I - BY ARSALAN


LINUX OS_I - BY ARSALAN

You might also like