gzip Command in Linux with Examples

Posted in

gzip Command in Linux with Examples

Sangeeta Gulia
Last updated on April 25, 2024

    Compression is the task of packing the large sized files and folders into a single file and reducing its space. In this article, we are going to discuss the gzip command along with its examples.

    Linux Command Utility

    In the Linux operating system , there is a Linux command feature. We may use these instructions to conduct a wide range of tasks, both simple and complex. There's a thing called a terminal, which is a command line interface for interacting with the system, similar to the command prompt in Windows. The terminal is the location where commands are run.

    However, keep in mind that the commands you type here are case-sensitive. Using linux commands, you can perform simple actions such as moving, deleting, and so on. Furthermore, linux commands can perform more complicated jobs, such as network or security-related activities.

    What is gzip Command?

    The files are compressed with this command. It combines all of your files into a single one. GNU zip header and deflated data are the components of that compressed single file.

    The syntax for writing this command is

    gzip [Options] [filenames]

    Options with gzip command

    1. -f option

    A file can't always be compressed. Perhaps you're trying to compress “file" but there's already a "file.gz" file. The "gzip" command will not normally operate in this situation.

    Simply use the -f option to compel the "gzip" command to do its job.

    2. -k option

    By default, when you use the "gzip" command to compress a file, you get a new file with the ending ".gz." If you wish to compress a file while keeping the original, you must use the gzip command.

    3. -L option

    The gzip license is shown using this option

    4. -v option

    This displays the name of each compressed or decompressed file, as well as the percentage decrease


    In this article, we went through various terms and options related to the gzip command of Linux. This command provides various options to perform tasks like compressing the original file itself, displaying the license, percentage decrease, etc.

    People are also reading:

    Leave a Comment on this Post