Sample Header Ad - 728x90

How to untar safely, without polluting the current directory in case of a tarbomb?

38 votes
6 answers
4822 views
Respectable projects release tar archives that contain a single directory, for instance zyrgus-3.18.tar.gz contains a zyrgus-3.18 folder which in turn contains src, build, dist, etc. But some punk projects put everything at the root :'-( This results in a total mess when unarchiving. Creating a folder manually every time is a pain, and unnecessary most of the time. - Is there a super-fast way to tell whether a .tar or .tar.gz file contains more than a single directory at its root? Even for a big archive. - Or even better, is there a tool that in such cases would create a directory (name of the archive without the extension) and put everything inside?
Asked by Nicolas Raoul (8465 rep)
Nov 11, 2015, 08:24 AM
Last activity: May 29, 2025, 02:32 PM