How to Resume Interrupted Tar Extraction in Ubuntu
This guide explains how to handle interrupted tar extractions on Ubuntu systems. Since the tar utility lacks a native resume feature, this article covers the specific command-line options required to skip existing files and verify archive integrity to prevent data corruption during the process.
The tar command does not support resuming an extraction
exactly where it left off like a download manager. If an extraction
process is interrupted, some files may be partially written. To continue
without re-extracting everything, you must use the
--skip-old-files option. This tells tar to ignore files
that already exist in the destination directory and only extract the
missing ones.
Run the following command in your terminal:
tar --skip-old-files -xf archive.tar.gzReplace archive.tar.gz with the name of your archive
file. If you are extracting to a specific directory, add the
-C flag:
tar --skip-old-files -xf archive.tar.gz -C /path/to/destinationBe aware that the file being extracted at the exact moment of
interruption may be corrupted. The --skip-old-files flag
will keep this partial file because it already exists. To ensure data
integrity, identify the most recently modified file in the destination
folder and delete it before running the command above. You can find the
latest file using:
ls -lt | head -n 2If the interruption occurred during the download of the archive
itself rather than the extraction, do not attempt to extract. Instead,
resume the download using wget -c or curl -O -
to ensure the archive file is complete before unpacking. Always verify
the checksum of the archive if available to confirm the file is not
corrupted before attempting extraction again.