Zip And Unzip Files

Make Files

echo "The number of soldiers in the regiment is 24." > regiment.txt
echo "The regiment has seen five battles." > battles.txt

Zip Files

The -v argument is optional, prints an output with the details of the operation.

gzip regiment.txt battles.txt -v
regiment.txt:	 -2.2% -- replaced with regiment.txt.gz
battles.txt:	 -5.6% -- replaced with battles.txt.gz

View Contents Of Directory

ls -l
total 8
-rw-rw-r-- 1 chris chris 68 Jul 31 13:15 battles.txt.gz
-rw-rw-r-- 1 chris chris 78 Jul 31 13:15 regiment.txt.gz

Unzip Files

gunzip regiment.txt battles.txt

View Contents Of Directory

ls -l
total 8
-rw-rw-r-- 1 chris chris 36 Jul 31 13:17 battles.txt
-rw-rw-r-- 1 chris chris 46 Jul 31 13:17 regiment.txt