Quick startgzip
Command to compress files
You can use a compression protocol called gzip to compress filesLZ77usegzip
command.
This is the simplest usage:
gzip filename
This will compress the file and append a.gz
Extension. The original file is deleted. To prevent this, you can use-c
Option and use output redirection to write the output tofilename.gz
file:
gzip -c filename > filename.gz
This
-c
The option specifies that the output will enter the standard output stream, while leaving the original file unchanged
Or you can use-k
Options:
gzip -k filename
There are various compression levels. The higher the degree of compression, the longer it takes to compress (and decompress). The level ranges from 1 (fastest, worst compression) to 9 (slowest, better compression), and the default value is 6.
you can use it-<NUMBER>
Options:
gzip -1 filename
You can compress multiple files by listing them:
gzip filename1 filename2
you can use it-r
Options:
gzip -r a_folder
This-v
Option to print compression percentage information. This is to combine it with-k
(Reserved) Options:
gzip
Can also be used to decompress files-d
Options:
gzip -d filename.gz
Thisgzip
This command can be used in Linux, macOS, WSL and wherever you have a UNIX environment
Download mine for freeLinux Command Manual
More cli tutorials:
- Bash shell
- Introduction to Bash Shell Script
- Fish shell
- Shell, monitor file content
- How to exit Vim
- UNIX editor
- UNIX file system commands
- Unix Shell Tutorial
- How to set an alias in macOS or Linux Shell
- Homemade practical guide
- How to fix XCRUN invalid active developer path error in MacOS
- Getting Started
- Introduction to Linux
- How to find the process that is using the port
- Linux command: mkdir
- Linux command: cd
- Linux command: pwd
- Linux command: rmdir
- Linux command: ls
- Linux command: mv
- Linux command: cp
- Linux commands: less
- Linux command: tail
- Linux command: touch
- Linux command: cat
- Linux command: find
- Linux command: ln
- Linux command: ps
- Linux command: echo
- Linux command: top
- Linux command: kill
- Linux command: killall
- Linux command: alias
- Linux command: job
- Linux command: bg
- Linux command: fg
- Linux command: Type
- Linux command: where
- Linux command: whoami
- Linux command: who
- Linux command: clear
- Linux command: su
- Linux command: sudo
- Linux command: chown
- Linux command: chmod
- Linux command: passwd
- Linux command: open
- Linux command: wc
- Linux commands: history
- Linux command: du
- Linux command: umask
- Linux command: grep
- Linux command: man
- Linux command: uname
- Linux commands: sort
- Linux command: uniq
- Linux command: diff
- Linux command: nohup
- Linux command: df
- Linux command: xargs
- Linux command: gzip
- Linux command: gunzip
- Linux command: ping
- Linux command: traceroute
- Linux command: tar
- Linux command: export
- Linux command: crontab
- Linux command: dirname
- Linux command: base name
- Linux command: printenv
- Linux command: env
- A short guide to the ed editor
- vim short guide
- A brief guide to emacs
- A brief guide to Nano
- Linux, no space left on the device
- How to use Netcat