tldr/pages/common/gzip.md

33 lines
1.0 KiB
Markdown
Raw Normal View History

# gzip
> Compress/uncompress files with `gzip` compression (LZ77).
2021-04-17 16:15:37 +01:00
> More information: <https://www.gnu.org/software/gzip/manual/gzip.html>.
- Compress a file, replacing it with a `gzip` archive:
2024-06-05 01:13:52 +01:00
`gzip {{path/to/file}}`
- Decompress a file, replacing it with the original uncompressed version:
2024-06-05 01:13:52 +01:00
`gzip {{-d|--decompress path/to/file.gz}}`
2021-07-04 22:02:33 +01:00
- Compress a file, keeping the original file:
2024-06-05 01:13:52 +01:00
`gzip {{-k|--keep path/to/file}}`
2021-07-04 22:02:33 +01:00
2024-06-05 01:13:52 +01:00
- Compress a file, specifying the output filename:
2024-06-05 01:13:52 +01:00
`gzip {{-c|--stdout path/to/file}} > {{path/to/compressed_file.gz}}`
- Decompress a `gzip` archive specifying the output filename:
`gzip {{-c|--stdout}} {{-d|--decompress}} {{path/to/file.gz}} > {{path/to/uncompressed_file}}`
2024-06-05 01:13:52 +01:00
- Specify the compression level. 1 is the fastest (low compression), 9 is the slowest (high compression), 6 is the default:
`gzip -{{1..9}} {{-c|--stdout}} {{path/to/file}} > {{path/to/compressed_file.gz}}`
2024-06-05 01:13:52 +01:00
- Display the name and reduction percentage for each file compressed or decompressed:
`gzip {{-v|--verbose}} {{-d|--decompress}} {{path/to/file.gz}}`