compress command is used to reduce the file size. After compression, the file will be available with an added .Z extension. File permissions will still remain the same as before using compress command. This command uses the adaptive Lempel-Ziv coding and it ignores the symbolic links. And also this command is part of ncompress package, which contains utilities for fast compression and decompression.
Note: If no files are specified then the standard input is compressed to the standard output.
compress [OPTION]... [FILE]...
- -v Option: It is used to print the percentage reduction of each file. This option is ignored if the -c option is also used. Compress example.xls and rename that file to example.xls.Z with a percentage reduction of 70.41%.
compress -v example.xls
- -c Option: Compressed or uncompressed output is written to the standard output. No files are modified. The -v option is ignored. Compression is attempted even if the results will be larger than the original.
compress -c example.xls > new.Z
- -r Option: This will compress all the files in the given directory and sub-directories recursively. It is helpful to combine the -r option with -v to see exactly what the command is doing.
compress -rv abc
This will compress all the files within abc.
- -f Option: This will compress files without any guarantee of size reduction, meaning it will compress files even if the file size is not reduced.
compress -f asc.txt
This will convert asc.txt into asc.txt.Z but size reduction is not assured.
- gs command in Linux with Examples
- du command in Linux with examples
- df command in Linux with Examples
- atq command in linux with examples
- fc Command in Linux with Examples
- wc command in Linux with examples
- ed command in Linux with examples
- last command in Linux with Examples
- tty command in Linux with examples
- top command in Linux with Examples
- pwd command in Linux with Examples
- man command in Linux with Examples
- help Command in Linux with examples
- bc command in Linux with examples
- cc command in Linux with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.