Can I safely remove a tar archive after extracting it?

Yes: once extracted you can safely remove it as long as it is easy to re-obtain a copy should you need it again (via download, external hard disk, etc.)

Put another way: if that tar or tar.gz is the ONLY copy in the world, you probably don't want to delete it ;)


This really depends on what you're using it for.

  1. If you may make changes to the extracted contents, which are hard or impossible to reverse, then you might need to keep the archive for re-extraction.

    For example, if you download a source code archive to install software from source, usually anything that goes wrong during compiling can be fixed with make clean or make distclean. But sometimes something might get messed up such that you want to start over, without having to bother re-downloading the source. For this reason, I almost always keep source code archives when building software from source.

  2. Some applications that use archives might need the original archive itself (and a re-created archive, from its extracted contents, won't do). A re-created archive would be equivalent in terms of the files, directory structure, and ownership/permissions/attribute information it contains. But it might not be exactly the same file, so a re-created archive may not have the same same md5, sha256, or other hash, used to verify that it is safe to use and not corrupted.

But these are the exceptions rather than the rule. Usually, you can re-download the archive if you need it again, and can feel free to delete it.