compress
Quick Reference
Command Name:
compress
Category:
file compression
Platform:
Linux/Unix
Basic Usage:
Common Use Cases
- 1
File compression
Compress files to save storage space
- 2
Data archiving
Create compressed archives of files and directories
- 3
Storage optimization
Reduce storage requirements through compression
- 4
Data transfer
Compress files for efficient data transfer
Syntax
compress [-cfvd] [-b bits] [file ...]
Options
Option | Description |
---|---|
-c |
Write to standard output; don't change input files |
-d |
Decompress input instead of compressing it |
-f |
Force compression even if it doesn't save space or the output file already exists |
-v |
Verbose mode; display compression ratio |
-b bits |
Set maximum code size (9 to 16, default is 16) |
Examples
How to Use These Examples
The examples below show common ways to use the compress
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
Basic Examples:
compress file.txt
compress -c file.txt > file.txt.Z
compress file1.txt file2.txt file3.txt
compress -d file.txt.Z