Education Series Part 03 – Compressing and Uncompressing Files

First I needed files so I created several.

# mkdir test0
# cd test0/
# touch file01.ogg file02.ogg file03.ogg file04.ogg file05.ogg
# ls
file01.ogg file02.ogg file03.ogg file04.ogg file05.ogg

Create a tar file out of the directory

# tar -czvf test0.tgz test0/
test0/
test0/file01.ogg
test0/file02.ogg
test0/file03.ogg
test0/file04.ogg
test0/file05.ogg

#ls
test0.tgz

Create a .tar.gz file (most common)

# tar -zcvf test0.tar.gz test0/
test0/
test0/file01.ogg
test0/file02.ogg
test0/file03.ogg
test0/file04.ogg
test0/file05.ogg

Untar the file:

# tar zxvf test0.tar.gz
test0/
test0/file01.ogg
test0/file02.ogg
test0/file03.ogg
test0/file04.ogg
test0/file05.ogg

Zip an entire directory

# zip -r test5.zip test0/

Unzip the directory:

# unzip test5.zip
Education Series Part 03 – Compressing and Uncompressing Files