Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

Gunzip Command in Linux - DesignLinux

Oct 26 2020
designlinux 0 Comments
Gunzip Command in Linux

Using Gunzip command-line tool you can decompressing Gzip files. Gzip is the popular compression algorithms to reduce the size of a file and keep the original file mode, ownership, and timestamp. In this tutorial, we will show you how to use the gunzip command.

Decompressing Files with gunzip#

Below is the basic syntax for the gunzip command:

gunzip [OPTION]... [FILE]...

The gunzip is a bash script wrapper to the gzip -d command in most Linux distributions, such as Ubuntu, CentOS, and Debian.

All gzip command line options are applicable gunzip. You can decompress a .gz file with gunzip by passing compressed file name:

gunzip filename.gz

It will restore the compressed file to its original name, owner, mode and timestamp.

After decompress, by default, gunzip will remove the compressed file. You can use the -k option to keep the file:

gunzip -k filename.gz

Use the -c option to write the output on the terminal.

gunzip -c filename.gz > /directory/path/filename

You can pass the multiple files as arguments with the gunzip command:

gunzip file1.gz file2.gz file3.gz

To recursively decompresses all files in a given directory, use the -r option:

gunzip -r directory

List the Compressed File Contents#

Use the -l option with gunzip, to show information about the given compressed files:

gunzip -l filename.gz

In output, it will show the uncompressed file name, the compressed and uncompressed size, and the compression ratio:

compressed        uncompressed  ratio uncompressed_name
       246                 282   8.2% filename

For more verbose output, use the -v option:

gunzip -lv filename
method  crc     date  time           compressed        uncompressed  ratio uncompressed_name
defla 8afa3fs5 Oct 24 11:40                 246                 282   8.2% filename

Conclusion#

The gunzip command is used to decompress .gz files. To learn more about the gunzip command, visit the Gnu gzip documentation page.

If you have any questions, please leave a comment below.

Related

Tags: gzip, terminal

How to Compare Strings in Bash

Prev Post

What is MongoDB? How Does MongoDB Work?

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 0
  • 606
  • 1,055,378

DesignLinux.com © All rights reserved

Go to mobile version