Command to compress a file

Hi,

When we want to compress a file which is of huge size then what command is best for us.Kindly suggest on this.

1.Tar command or
2.gzip command

OS -- Linux 2.6

Regards,
Maddy

tar is an archive tool not a compressing tool, but we do happen to use tar with compression tools, and so we know change also the suffix like .tar.gz or .tgz

For just one file we do not need an archive (tar = tape archive).
Go for gzip! (To be unpacked with gunzip)
Alternative: bzip2 (Better compression but much longer compression time. To be unpacked with bunzip2)

2 Examples, of which each:

  1. line will archieve/compress all files in current dir.
  2. line will extract the archieve to current dir.
tar -acf tarball.tar.gz *
tar -axf tarball.tar.gz

gzip *
gunzip *gz

NOTE: g(un)zip will actualy change the file, and not create a new file which is (un-)compressed!

Hope this helps

I use "compress" command in Linux, it does a good job.

compress is a very old-fashioned compressor which is liable to make output larger than its input under certain circumstances.

Thank you all for your inputs.