atools: unpack file archives agnostically
• 184 words • 1 min • updated
When downloading software from the interwebs, it can come in many popular
archive formats: .zip, .tar.gz, .tar.xz, .rar, .7z, etc.
If you extract them via the CLI, normally you have to remember the right command and flags to pass for each different format, e.g.:
% unzip foo.zip
% tar xzvf foo.tar.gz
[...]It’s not too bad but it’s unnecessary overhead that can be abstracted away. And there are several ways to do so.
At some point I used dtrx:
% dtrx vault_1.7.2_linux_amd64.zip…but it used to be Python 2 only. These days there is a Python 3 version but
it was too late, at some point I switched to atool:
% brew ls atool
/opt/homebrew/Cellar/atool/0.39.0/bin/acat
/opt/homebrew/Cellar/atool/0.39.0/bin/adiff
/opt/homebrew/Cellar/atool/0.39.0/bin/als
/opt/homebrew/Cellar/atool/0.39.0/bin/apack
/opt/homebrew/Cellar/atool/0.39.0/bin/arepack
/opt/homebrew/Cellar/atool/0.39.0/bin/atool
/opt/homebrew/Cellar/atool/0.39.0/bin/aunpack
/opt/homebrew/Cellar/atool/0.39.0/share/man/ (7 files)The only command I use from the package is aunpack, which behaves similarly to
dtrx:
% aunpack vault_1.7.2_linux_amd64.zipatool is globally available in
all software repositories I care about.
And then I can free up my mind.
With that said, it’s still useful to remember the unpacking commands for at the very least .zip and .tar.gz.