21 02 | 2013

One archiver to rule them all: bsdtar

Written by Tanguy

Classified in : Homepage, Debian, Command line

Package icon

Sometimes, you have to use ZIP archives, or worse, RAR archives (curse them!), with one significant annoyance: zip, unzip, rar and unrar use a rather uncommon command line convention, compared to the usual tar, cpio and pax.

This is where bsdtar and bsdcpio come handy: these two equivalent tools from FreeBSD do not directly implement any archive format, relying on libarchive to do that instead. That allows you to do thinks like:

% bsdtar -tf crap.rar
% bsdtar -xf crap.rar
% bsdtar --format zip -cf stuff.zip stuff

Too bad it does not have a -a option to automatically select the archive format as GNU tar does.


thursday 21 february 2013 à 13:56 suggestion joe said : #1

I just use atool and don't even think about formats any more.

thursday 21 february 2013 à 18:02 Tanguy said : #2

@suggestion joe : Yes, apack is good too, while bsdtar and bsdcpio are more useful to people which, like me, are addicted to tar or cpio's interface.

It is worth noting, however, that contrary to atool which uses unrar and only has partial support or RAR archives, bsdtar/bsdcpio uses libarchive which provides a full support for them, imported from the Unarchiver.

friday 22 february 2013 à 00:38 laurentb said : #3

I use dtrx, as it prevents issues with extracting archives with no parent directory (usually .zip).

wednesday 06 march 2013 à 02:29 Axel said : #4

I also prefer atool, mostly for its additional commands like adiff, als and acat. (I though still miss "agrep". ;-)

But there's also "unp" (short for unpack) which probably has the best balance between a short and an easy to remember command name. It also includes "ucat" which works similar to acat.

I seldom have dtrx installed on Debian, because it pulls in quite some megabytes of RPM stuff as hard dependency I usually don't need.

The p7zip-full package in Debian also supports a bunch of archive formats, but most 7z tools have not so common command line interfaces.

Write a comment

What is the fourth letter of the word rqdrm? :