Archives

From The World according to Vissie
Jump to navigation Jump to search

Atool

Atool is a perl script that uses different tools or commands behind the scenes for different archive types. Atool comes with a number of commands like aunpack, apack, als, acat, adiff and arepack. These executables are just the symbolic links to atool command. Atool can handle various file archives like zip, compress(.z), jar, rar, 7z, bzip, gzip, rpm, deb, cpio, tar, tar.gz. tar.bz, tar.bz2, tar.7z and many more. It relies on the file extension for determining the archive type. If it is not possible to identify the archive with file extension, file command is used.

The commands available with atool are simple commands. Some examples of these commands are:

aunpack.

aunpack is used to extract an archive. It is similar to executing "atool -x" for extracting an archive.

aunpack file.tar.gz
atool -x file.tar.gz

acat.

The acat command or "atool -c" can be used to view a file from the archive.

acat file.tar.gz file_jan

als.

To list contents of an archive, use als or "atool -l".

als file.tar.gz
-rw-r--r-- raghu/raghu 0 2012-08-20 12:29 file_mar
-rw-r--r-- raghu/raghu 9 2012-08-20 12:35 file_feb
-rw-r--r-- raghu/raghu 8 2012-08-20 12:36 file_jan

apack.

This command creates the archive. The same can be achieved through "atools -a".

apack dir1.tar.gz dir1/

arepack.

It repacks the archive into another format. In order to do this, it first extracts the archive into a temporary directory and then creates the new archive from this temporary directory. The original archive is not deleted.

arepack dir1.tar.gz dir1.7z

tar

multi volume tar

Create multi volume tar files. This example will create file of 1.2 Gig:

tar -cML 1258291 -f vmiso.tar ./multi

When first file reached 1.2GB (after some minutes) it will display a prompt to move to next file, it will ask if volume #2 for this archive is ready, type this answer, notice the "2" and the n with space:

n my_documents2.tar

to then decompress them you can use:

tar -xMf my_documents.tar

After some work (minutes on most servers), it will ask for next file, type this:

n my_documents2.tar

Then on next question type n my_documents3.tar, etc.

Or, if your tar maybe does not have the "M" option (like on ESXi), you can "just" concat them:

cat my_documents.tar my_documents1.tar my_documents2.tar .... >> new.tar
tar -xvf ./new.tar