Linux GZIP and GUNZIP Command with It's Uses and Examples.

Linux GZIP and GUNZIP Command with It's Uses and Examples.

Linux is the most used operating system. It is free to available for all computers, desktops, mobile etc. There are many advantages of using Linux on your computer such as its portable nature, multi-user support and when it comes to the security, it offers best protection like password protection, controlled access to specific files and more. Debian, Fedora, Redhat, Ubuntu, and Mint are just a few of the Linux version available to end users that you can download without any hassle, it’s all free.
Linux is based on commands. We use various commands for changing anything in graphical section. Here we are going to tell you GZIP/GUNZIP command in Linux.

What are gzip commands, uses, and examples in Linux?
Gzip stands for GNU zip. It is basically used for compress a file. It is most widely used compression tool in Linux. Gzip uses Lempel-Ziv coding to reduce the file size. Gzip compresses a file size with the extension ".gz" and deletes the old file at the same times.
Here is the Gzip command that you can use to compress a file in Linux.
1). Using the following command you can compress a single file:
# gzip filename [Syntax]
For example, you have a file and the name of file is “important document” than you need to write the following command:
# gzip important document.odt
Documents, text files, images, audio, video and everything you can compress by using this command. If you want to decompress a file or folder, you can apply the following command to already compressed file.
# gzip -d filename.gz [Syntax]
# gzip -d important document.odt.gz [Example]
2). If you want to keep the original file that you wish to compress so use the following command:
# gzip -k filename [Syntax]
# gzip -k important document.odt [Example]
What are Gunzip commands, uses, and examples in Linux?
Gunzip stands for GNU unzip. It is used for decompressing a file that was compressed by Gzip. Here we will show command and some examples to decompress a file.
1). Using the following command you can decompress a file:
# unzip filename [Synatx]
For example, you have a zipped up a file, the name of the file is “my documents”. To unzip a file by using the following command:
# unzip “my documents” [Example]
2). If you have multiple files so you can use below command to decompress multiple files:
# unzip filename1 filename2 filename3 [Syntax]
For instances, I have a zipped folder as “personal documents” which contains the separate files as “exemple1”,” exemple2”, and “exemple3”.
Using the following command you can unzip these files:
# unzip “exemple1” ” exemple2” “exemple3” [Example]
3) If you don’t want to extract all the files in zip folder so you can use the following command:
# unzip filename.zip -x filetoexclude.zip [Synatx]
For example: If you have folder name as “college documents” and you want to extract all the files in the folder expect one for “marksheets” then you can use the following command:
# unzip college documents.zip -x "marksheets.doc" [Example]
These are some useful commands that you can use to compress and decompress your files and folders. There are some other commands also for compressing and decompressing data or content in the files or folders.
Author
bhawanisingh
Views
3,512
First release
Last update
Rating
0.00 star(s) 0 ratings
Top