Table of Contents
- Introduction
- What is the
gzip
Command? - Core
gzip
Commands - Real-World Scenario:
gzip
Command - Conclusion
- Let's Connect
Introduction
Welcome back to Day 22 of this practical Linux challenge! Today, we are diving into one of the most useful Linux commands: gzip
.
When you think of compressing any file, think of gzip
What is the gzip
Command?
gzip
stands for GNU zip, a tool used to compress files, making them smaller and easier to store or transfer.
Core gzip
Commands
More commonly used gzip
command options are listed in the table below.
gzip Command |
Description |
---|---|
gzip filename |
Compress the file (creates filename.gz ) |
gunzip filename.gz |
Decompress .gz file back to original |
gzip -k filename |
Compress file and keep original |
gzip -r folder/ |
Recursively compress all files in a folder |
gzip -d filename.gz |
Same as gunzip , decompress file |
gzip -v filename |
Verbose mode – shows compression info |
Worthy to note that this command works only for files, not folders.
Real-World Scenario: gzip
Command
- Select a file you wish to compress. Compress using the
gzip
command. It ends with.gz
gzip demologs.txt
ls -lh # to confirm it compressed
- Now you have seen how it works, let's decompress that
.gz
file back to the original format.
gunzip demologs.txt.gz
- If you notice when we compressed, it did not keep the original file. Now, let's keep the original file and the compressed file.
gzip -k demologs.txt
ls -lh # to confirm both the original and compressed file are there
Conclusion
Learning gzip might seem simple, but it is a crucial skill in Linux.
Mastering it helps you maintain lean storage and improve transfer speeds.
If this is helpful to you, feel free to bookmark, comment, like and follow me for Day 23!
Let's Connect!
If you want to connect or share your journey, feel free to reach out on LinkedIn.
I am always happy to learn and build with others in the tech space.
#30DaysLinuxChallenge #Redhat#RHCSA #RHCE #CloudWhistler #Linux #Rhel #Ansible #Vim #CloudComputing #DevOps #LinuxAutomation #IaC #SysAdmin#CloudEngineer
Top comments (0)