How to compress files in UNIX and the commands used ?

Questions by ayypss

Showing Answers 1 - 14 of 14 Answers


  • Feb 15th, 2007

using "TAR" command

  Was this answer useful?  Yes


  • Feb 15th, 2007

use tar with -z optionex.. tar -zcvf 1.tar dir

Manish Singh

  • Dec 2nd, 2012

The best possible way to compress in Unix is by using tar and gzip utilities together.

tar utility will club multiple files in a single file and make a file with .tar extension.

Then we can use the gzip command on this tar file which will compress all the files together.

The compression can go upto 20-30%B based on file contents.

  Was this answer useful?  Yes


  • Dec 15th, 2012

By using tar, compress, zip

  Was this answer useful?  Yes


  • May 2nd, 2013

Compress or expand files.

gzip [ -acdfhlLnNrtvV19 ] [-S suffix] [ name ... ]
gunzip [ -acfhlLnNrtvV ] [-S suffix] [ name ... ]
zcat [ -fhLV ] [ name ... ]

gzip myfile

or using

compress [-c] [-f] [-v] filenames

Example: compress -v bigfile.exe

  Was this answer useful?  Yes

shreenidhi R

  • Sep 10th, 2013

tar -zxvf filename.tar
tar -zxvf filename.tar.gz

  Was this answer useful?  Yes

There are many ways to compress files in UNIX. The commands used to compress a file in UNIX are compress, zip, gzip, bzip2, and tar.
compress file_to_compress
zip .zip-filename file_to_compress
gzip file_to_compress
bzip2 file_to_compress
tar czvf file.tgz file_to_compress


  • Sep 22nd, 2015

You can use the command Unzip to compress a file.

  Was this answer useful?  Yes


  • Nov 24th, 2015

gzip command can zip file.

  Was this answer useful?  Yes


  • Dec 31st, 2015

No to unzip a file command used is gunzip file_name

  Was this answer useful?  Yes

Subrata Chakrabortty

  • Mar 9th, 2016

compress/uncompress filename, gzip/gunzip file, bzip2/bunzip2 file

  Was this answer useful?  Yes


  • Jun 4th, 2016

Lot of options available like gzip, compress and tar

  Was this answer useful?  Yes


  • Jun 22nd, 2017

gzep filename.gz

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions