"gzip/gunzip" - Compressed *.gz Files

This section provides a tutorial example on how to use 'gzip' and 'gunzip' commands to compress large files and restore them later. Compressed files will have the *.gz file name extension.

If you have a large file, you may want to compress it with the "gzip" utility to save storage space.

1. Compress a file with the "compress" command, which uses the Lempel-Ziv algorithm. The original file is replaced with the compressed version and renamed to the same name plus the extension .gz.

herong$ cp history-of-linux.txt history-of-linux-bck.txt

herong$ gzip history-of-linux.txt

herong$ ls -l history*
-rw-r--r--  1 herong  staff  1444  history-of-linux-bck.txt
-rw-r--r--  1 herong  staff   834  history-of-linux.txt.gz

2. Restore a compressed file with the "gunzip" command. The compressed file is replaced with the restored version and renamed to the original name without the extension .gz.

herong$ gunzip history-of-linux.txt.gz

herong$ ls -l history*
-rw-r--r--  1 herong  staff  1444  history-of-linux-bck.txt
-rw-r--r--  1 herong  staff  1444  history-of-linux.txt

Table of Contents

 About This Book

 Introduction to Linux Systems

 Cockpit - Web Portal for Administrator

 Process Management

Files and Directories

 "find" - Search for Files

 "more", "head" and "cat" - Read Files

 "split" and "cat" - Split and Join Files

 Truncate Log Files

 "compress/uncompress" - Compressed *.Z Files

"gzip/gunzip" - Compressed *.gz Files

 "xz/unxz" - Compressed *.xz or *.lzma Files

 "tar -c" and "tar -x" - Create and Extract Archive Files

 "zip" and "unzip" - Create and Extract ZIP Files

 "Operation not permitted" Error on macOS

 Users and Groups

 File Systems

 Block Devices and Partitions

 LVM (Logical Volume Manager)

 Installing CentOS

 SELinux - Security-Enhanced Linux

 Network Connection on CentOS

 Internet Networking Tools

 SSH Protocol and ssh/scp Commands

 Software Package Manager on CentOS - DNF and YUM

 vsftpd - Very Secure FTP Daemon

 Postfix - Mail Transport Agent (MTA)

 Dovecot - IMAP and POP3 Server

 Email Client Tools - Mail User Agents (MUA)

 LDAP (Lightweight Directory Access Protocol)

 Administrative Tasks

 References

 Full Version in PDF/EPUB