Compressing or Decompressing files from the unix command line is quite simple. There are a couple of common compression methods:
GZIP (file.txt.gz)
Compress file (ie. produce a .gz compressed file)
file.txt
gzip file.txtDecompress file
file.txt.gz
gunzip file.txt.gzBZIP2 (file.txt.bz2)
Compress file (ie. produce a .bz2 compressed file)
file.txt
bzip2 file.txtDecompress file
file.txt.bz2
bunzip2 file.txt.bz2TAR (file.tar) - Tape ARchive - Generally used to gather a folder the files and sub-folders contained within into a single file
Archive folder with tar alone
MyData/
tar cvf MyData.tar MyData/Archive with tar and Compress with gzip or bzip2
MyData/
tar cvzf MyData.tar.gz MyData/ORtar cvjf MyData.tar.bz2 MyData/
Unarchive Standard or Compressed Tar Files
file.tar
tar xvf file.tarfile.tar.gz
tar xvzf file.tar.gzfile.tar.bz2
tar xvjf file.tar.bz2Notes:
c = Create
x = eXtract
v = File to manipulate
z = File to manipulate is gzip-compressed
j = File to manipulate is bzip2-compressed