compress more than one file

hi,
I need to compress a couple files in a directory.i tried using
tar cvf filename1 filename2
but i am not able to open tar file.
please suggest how to compress more than one file in to same file
thanks in advance

To pack all the files together:

tar cvf outputfile.tar filename1 filename2

To unpack:

tar xvf inputfile.tar

Where inputfile.tar is the file created before.

Note that tar only put files together, if you want compression you then need to compress the resulting tarfile with something like compress, gzip, bzip, etc...

Thanks alot its working