- gzip command is used to compress or exapand files on the Linux/UNIX systems.
- It comes from “gzip-1.3.12” package, below we have covered almost all the gzip options
Examples:
1. To compress any file
$ gzip file |
2. To decompress a file
$ gzip -d file.gz $ gzip –decompress file.gz $ gzip –uncompress file.gz |
3. To see the compressed file content
$ gzip -c file.gz $ gzip –stdout file.gz $ gzip –to-stdout file.gz |
4. To forcefully compress/decompress any file
$ gzip -f file $ gzip –force file $ gzip -d -f file.gz $ gzip -d –force file.gz |
5. To not to save the original file name
$ gzip -n file $ gzip –no-name file |
6. To save the original file name and time stamp
$ gzip -N file $ gzip –no-name file |
7. To suppress all warnings
$ gzip -q file $ gzip –quiet file |
8. To zip the files recursively
$ gzip -r /tmp $ gzip –recursive /tmp |
9. To specify your own suffix instead of .gz
$ gzip -S .cz file $ gzip –suffix .cz file |
10. To test the integrity of files
$ gzip -t file.gz $ gzip –test file.gz |
11. To specify the speed for compression
$ gzip -1 file $ gzip –fast file $ gzip -9 file $ gzip –best file |
12. To display the gzip license info
$ gzip -L $ gzip –license |
13. To get the version info
$ gzip -v $ gzip –version |
14. To list the help
$ gzip -h $ gzip –help |