Use gzip to compress a file:
gzip file1.txt
Uncompress a gzip file:
gzip -d file1.txt.gz
Use bzip2 to compress a file:
bzip2 file1.txt
Uncompress a bzip2 file:
bzip2 -d file1.txt.bz2
See: http://www.coderanch.com/t/505258/Applets/java/pack-gz-file-unpack-create
Pack a jar file.
pack200 archive.pack.gz archive.jar
Unpack a jar file.
unpack200 archive.pack.gz archive.jar
List the content of a jar archive.
unzip -l archive.jar
Use tar to collect a bunch of files into one file.
Tar and compress all files in /opt into file called opt.tar.gz
tar czvf opt.tar.gz /opt
Untar files back to /opt
tar xvzf opt.tar.gz /opt
Tar and compress all files in /opt into file called opt.tar.bz
tar cjvf opt.tar.gz /opt
Extract a tar.bz2 file.
tar -jxvf filename.tar.bz2
Use star to archive files on a system using SELinux
Install star.
yum install star
Create file opt.star and save all extended attribs record headers with acl
star -xattr -H=exustar -c -f=opt.star /opt/
Extract a star archive.
tar -x -f=opt.star
List the content of a zip archive.
unzip -l archive.zip