Is there a utility to extract/compress files using any type of archiving algorithm?

I just realized that 7-Zip (command 7z) can do it. 7-Zip is able to extract and compress many types of archives. Here is a quote from man 7z:

DESCRIPTION
    7-Zip is a file archiver with the highest compression ratio. The pro-
    gram supports 7z (that implements LZMA compression algorithm), LZMA2,
    XZ, ZIP, Zip64, CAB, RAR (if the non-free p7zip-rar package is
    installed), ARJ, GZIP, BZIP2, TAR, CPIO, RPM, ISO, most filesystem
    images and DEB formats...

7-Zip can extract/compress archives and is detecting the compressing algorithm itself.

This should work as you are expecting:

Compressing

$ 7z a file.tar.gz file
$ 7z a file.zip file
$ 7z a file.7z file
$ 7z a file.gzip file

Extracting

$ 7z x file.tar.gz
$ 7z x file.zip
$ 7z x file.7z
$ 7z x file.gzip

Also here is a little test. Here I create five archives and give them different filename extensions.

$ cd /tmp
$ touch testfile
$ for alg in {zip,gzip,7z,tar.gz,rar};do 7z a testfile."$alg" testfile;done
$ ls testfile*
testfile.7z
testfile.gzip
testfile.rar
testfile.tar.gz
testfile.zip

Now to detect the compressing algorithm, I will use the binwalk utility.

$ for arch in testfile.*;do binwalk "$arch" | sed -n '4p' | awk {'print $3'};done
7-zip
gzip
7-zip
gzip
Zip

http://packages.ubuntu.com/trusty/dtrx

intelligently extract multiple archive types

To install:

sudo apt-get install dtrx

Homepage: http://brettcsmith.org/2007/dtrx/