Black Friday 2025 – NPI EA (cat = Baeldung on Linux)
announcement - icon

Yes, we're now running our Black Friday Sale. All Access and Pro are 33% off until 2nd December, 2025:

>> EXPLORE ACCESS NOW

Baeldung Pro – Linux – NPI EA (cat = Baeldung on Linux)
announcement - icon

Learn through the super-clean Baeldung Pro experience:

>> Membership and Baeldung Pro.

No ads, dark-mode and 6 months free of IntelliJ Idea Ultimate to start with.

Partner – Orkes – NPI EA (tag=Kubernetes)
announcement - icon

Modern software architecture is often broken. Slow delivery leads to missed opportunities, innovation is stalled due to architectural complexities, and engineering resources are exceedingly expensive.

Orkes is the leading workflow orchestration platform built to enable teams to transform the way they develop, connect, and deploy applications, microservices, AI agents, and more.

With Orkes Conductor managed through Orkes Cloud, developers can focus on building mission critical applications without worrying about infrastructure maintenance to meet goals and, simply put, taking new products live faster and reducing total cost of ownership.

Try a 14-Day Free Trial of Orkes Conductor today.

1. Overview

Sometimes, when working in Linux, we may have multiple Gzip files that we’d like to merge into a single Gzip file.

In this tutorial, we’ll explore some of the simple and useful and tools we can use to concatenate multiple Gzip files into one from the Linux command line.

2. Gzip Files

The Gzip file compression algorithm, which uses the .gz file extension, helps us reduce file sizes without impacting the timestamp, file ownership, or mode. We can use the gzip command to compress single or multiple files.

Here, we see the output of a gzip command along with a reduction percentage in size for the geckodriver file:

$ gzip -v geckodriver 
   geckodriver:     60.8% -- replaced with geckodriver.gz

3. Concatenation of Gzip Files

We can use some common commands like cat and tar to concatenate Gzip files in the Linux system.

3.1. Using the cat Command

The gzipped files can be concatenated using the cat command. Here, we’ll concatenate the files geckodriver.gz and geckodriver-linux.gz to create the file concatefile.gz:

$ cat geckodriver.gz geckodriver-linux.gz > concatefile.gz 

The command ls -sh gives the details of the above files after concatenation:

$ ls -sh
   total 18008
   9000 concatefile.gz	 5296 geckodriver-linux.gz   3712 geckodriver.gz

3.2. Using the tar Command

The tar command’s original use was for reading and writing tape archives. We can use tar to generate archive files and extract files from them. Here, we’ll create the tar file concatefile.tar to contain our two Gzip files:

$ tar -cvf concatefile.tar geckodriver.gz geckodriver-linux.gz 
    a geckodriver.gz
    a geckodriver-linux.gz

The command ls -sh gives the details of the above files after concatenation with the tar command:

$ ls -sh
    total 18016
    9008 concatefile.tar   3712 geckodriver-linux.gz  5296 geckodriver.gz

4. Conclusion

In this article, we have explored how cat and tar commands are useful in concatenating multiple Gzip files in Linux.