Commands.page Logo

How to Merge Split Tar Archive Parts in Ubuntu Linux

This article provides a concise guide on reassembling split tar archive files within the Ubuntu operating system. It details the specific command-line tools required to merge separated parts back into a single usable archive and extract the original data without errors.

The Command to Merge Split Archives

The primary command used to merge split tar archive parts back together is cat. When a large tar file is split into smaller chunks using the split command, the resulting files usually have extensions like .tar.aa, .tar.ab, .tar.ac, and so on. To reconstruct the original archive, you must concatenate these files in the correct alphabetical order.

Step-by-Step Instructions

  1. Open your terminal in the directory containing the split files.

  2. Use the cat command to combine the parts into a single tar file. The syntax is as follows:

    cat archive.tar.* > archive.tar

    This command finds all files starting with archive.tar. and merges them into archive.tar.

  3. Once merged, you can extract the contents using the standard tar command:

    tar -xf archive.tar

Alternative Method for Direct Extraction

If you do not need to create a single merged tar file first, you can pipe the output of cat directly into tar for extraction. This saves disk space by avoiding the creation of an intermediate file. Use the following command:

cat archive.tar.* | tar -x

This method reads the split parts, combines them in memory, and extracts the contents immediately. Ensure all split parts are present in the directory before running either command to prevent corruption errors.