gzip command compresses single or multiple files. The compressed file ending with the extension (.gz), generally size of compressed file will be less than the size of the original file.

The gzip command uses a deflate algorithm, deflate algorithm a lossless data compression that creates smaller file sizes to make file transfer much faster.

Load WordPress Sites in as fast as 37ms!

gzip only reduces the size of a file and keeps the original file mode, ownership, and timestamp. It means compressed data remains the same after decompressing. To decompress the files, gunzip command is used and your original file will be back.

In this tutorial, you will learn about gzip command and uses of gzip command with examples

Benefits of compressed file

gzip command is used to compress the files. The benefits of compressed files are the following

Load WordPress Sites in as fast as 37ms!
  • To save disk space. gzip command compresses the file and creates smaller file sizes.
  • To save bandwidth. Smaller file sizes reduce the bandwidth and also make it easy to transfer large amounts of data over the internet.

Syntax for gzip command

gzip [options] file1 file2 file3.......

Uses of gzip command with examples

cat abc.txt

cat filename

Compress the files

Simply using gzip without any options compresses the file and replaces the files with the same file name with a .gz extension. gzip can be used to compress a single file or multiple files.

Load WordPress Sites in as fast as 37ms!

For Single file

gzip filename
gzip abc.txt

gzip filename

gzip -v def.txt

gzip -v filename-1

Load WordPress Sites in as fast as 37ms!

For multiple files

gzip file1 file2 file3 .....
gzip 123.txt 456.txt

gzip command file1 file2 multiple files

Load WordPress Sites in as fast as 37ms!
gzip -k ghi.txt

gzip command -k filename

gzip -L def.txt.gz

gzip command -L zipfile

gzip -d 123.txt.gz

gzip command -d filename

Load WordPress Sites in as fast as 37ms!

 

gzip -d 456.txt.gz abc.txt.gz def.txt.gz ghi.txt.gz

gzip command -d file1 file2 multiple files

gzip -k ghi.txt

gzip command -k filename

gzip -L def.txt.gz

gzip command -L zipfile

 

 

A
adduser | addgroup | alias | anacron | apt | aptitude | arp | at | atq | atrm | awk
B
basename | banner | batch | bc | bg | bzip
C
cat | cal | cd | chgrp | chown | cksum | chmod | clear | cmp | comm | cp
D
date | dd | df | diff | dir | dmidecode | du
E
echo | eject | env | exit | expr
F
factor | find | free
G
grep | groups | gunzip | gzip
H
head | history | hostname | hostnamectl | htop | hwclock | hwinfo
I
id | ifconfig | ionice | iostat | ip | iptables | iw | iwlist
J
K
kill | kmod
L
last | less | ln | locate | login | lp | ls | lshw | lscpu | lsof | lsusb
M
man | mdsum | mkdir | more| mv
N
nano | nc | neofetch | netcat | netstat | nice | nmap | nproc
O
openssl
P
passwd | pidof | ping | pr | ps | pwd | pstree
Q
R
rdiff-backup | reboot | rename | rm | rmdir | rnmod
S
scp | shred | shutdown | sleep | sort | split | ssh | stat | su | sudo | sum
T
tac | tail | talk | tar | tee | time | tree | top | touch | tr
U
unalias | uname | uniq | unzip | uptime | users
V
vim | vi
W
w | wall | watch | wc | wget | whatis | whereis | which | who | whoami
X
xargs
Y
yes | youtube-dl
Z
zcmp | zdiff | zip | zz

Sharing is Caring
Load WordPress Sites in as fast as 37ms!
Scroll to Top