What happens when a compress command is used in UNIX system?

compress command is used for compressing a file that is for making the file size compact so that it becomes small. When a compress command is used in UNIX all the file attributes like the owner of the file and other things remain same except the file size is compressed and the extension of the file becomes .Z

The general syntax for compressing file is

compress filename

For instance if one like to compress the file named as Exforsys it can be done as follows:

compress Exforsys

The above is a generalized compress command without any options, There are many options available in compress command. Some of which are mentioned below namely:

  • compress with –c option 

  • compress with –v option

compress with –c option:

When a –c option is used with compress command then the output is written to the display screen and so no .Z files are created.

compress with –v option:

-v option with compress command gives report on the file size by which the file has got compressed.

To add further to this related area of context there is another command called as uncompress which is used to uncompress the file.

Questions by GeekAdmin   answers by GeekAdmin

Showing Answers 1 - 1 of 1 Answers


  • Mar 7th, 2007

Exactly as in the above comment Compress command is for compressing the file and it can uncompress when ever required.

compress <filename> - to compress
uncompress <filename> - to uncompress

After compressing a file of 3.5 KB size will get reduce to 1.5 KB (aprx).

If still the size need to be reduced use "gzip" which reduce the same size of 3.5 KB file to 0.7 KB (aprx)

gzip <filename> - to compress
gunzip <filename> - to uncompress

  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