Home Command line utilities Patool – A Portable Command Line Archive File Manager

Patool – A Portable Command Line Archive File Manager

By sk
Published: Updated: 1.3K views

There are multitude of archiving tools to manage dozens of archiving file formats. Each tool has its own commands and parameters. If your system has GUI installed, there won't be a problem to manage archive files. Just right click the zip files and click extract or extract files. Likewise, right click on any folder or file and choose Compress to compress them. On the contrary, if you have a system with only CLI,  you will have to memorize all commands and parameters for managing different archive format files. This can be little difficult and unnecessary too. No worries! Meet Patool, a portable command line archive file manager that supports almost all archive formats. In a nutshell, we don't need to install numerous archive managers. Patool is just enough to do all sort of archiving stuffs.

The list of supported archive file formats are given below.

  • 7z (.7z, .cb7),
  • ACE (.ace, .cba),
  • ADF (.adf),
  • ALZIP (.alz),
  • APE (.ape),
  • AR (.a),
  • ARC (.arc),
  • ARJ (.arj),
  • BZIP2 (.bz2),
  • CAB (.cab),
  • COMPRESS (.Z),
  • CPIO (.cpio),
  • DEB (.deb),
  • DMS (.dms),
  • FLAC (.flac),
  • GZIP (.gz),
  • ISO (.iso),
  • LRZIP (.lrz),
  • LZH (.lha, .lzh),
  • LZIP (.lz),
  • LZMA (.lzma),
  • LZOP (.lzo),
  • RPM (.rpm),
  • RAR (.rar, .cbr),
  • RZIP (.rz),
  • SHN (.shn),
  • TAR (.tar, .cbt),
  • XZ (.xz),
  • ZIP (.zip, .jar, .cbz)
  • ZOO (.zoo)
  • and many.

Install Patool, the Command line Archive file manager

Patool can be installed easily using Pip, a package manager for installing software written using Python.

Let us install python-pip first.

On Arch Linux and derivatives:

$ sudo pacman -S python-pip

On Debian, Ubuntu, Linux Mint:

$ sudo apt-get install python-pip

On RHEL, CentOS, Fedora:

$ sudo yum install python-pip


$ sudo dnf install python-pip


$ sudo zypper in python-pip

Once pip installed, run the following command to install Patool archive manager.

$ sudo pip install patool

Sample output:

Collecting patool
 Downloading patool-1.12-py2.py3-none-any.whl (77kB)
 100% |████████████████████████████████| 81kB 41kB/s 
Installing collected packages: patool
Successfully installed patool-1.12

How to use Patool in Linux

Patool usage is fairly simple and straight forward. Let me show you how to use it with some examples.

Extract files

To extract a compressed file, run:

$ patool extract test1.zip

Sample output:

patool: Extracting test1.zip ...
patool: ... test1.zip extracted to `Inter.txt'.

Also, you can extract multiple and different archive format files in one go.

$ patool extract test1.zip test2.rar


$ patool --verbose test3 test4.tar.gz

Here, --verbose parameter will display more info about what patool actually does, and display the output of helper applications.

View contents of archive file without extracting it

You can view the contents of an archive file without having to extract it.

$ patool list linux-4.9.tar.xz

This command lists all files of linux-4.9.tar.xz tarball.

Create archives

To create an archive, just run:

$ patool create myfiles.zip *.txt

The above command will create a zip file of all txt files in the current directory.

Sample output:

patool: Creating myfiles.zip ...
patool: ... myfiles.zip created.

To create archive of a file and folder in the current directory, run:

$ patool --verbose create myarchive.zip file1.txt directory1/

Sample output:

patool: Creating myarchive.zip ...
patool: ... myarchive.zip created.

View difference between two archives

To view the differences between two archives, run:

$ patool diff test1-0.6.1.gz test2-0.6.1.bz2

Sample output:

patool: Comparing test1-0.6.1.gz with test2-0.6.1.bz2 ...
patool: running /usr/bin/diff -urN /tmp/Unpack_WdttOc /tmp/Unpack_8ZDyPK
patool: ... no differences found.

Repack archive to different format

Patool can able to repackage an archive to a different format as shown below:

$ patool repack test1.tar.gz test1.tar.bz2

Sample output:

patool: running '/usr/bin/gzip' -c -d -- 'test1.tar.gz' > '/tmp/Unpack_syZlDc/test1'
patool: with shell='True'
patool: ... test1.tar.gz extracted to `/tmp/Unpack_syZlDc'.
patool: ... repacking successful.

Shrink archive size

Not happy about the compression size? Well, you can recompress an archive to a smaller size.

$ patool recompress images.zip

Sample output:

patool: Recompressing test1.zip ...
patool: ... test1.zip extracted to `/tmp/Unpack_tiX7Om'.
patool: ... recompressed file is now 35B smaller.

List archive formats

To list all supported archive formats, run:

$ patool formats

Getting help

To view all available commands along with their brief explanations, run:

$ patool -h

For more details, check the official website given at the end of this article or refer the man pages.

$ man patool

Suggested read:

Hope this helps. Have you already used this? Great! Let us know your experience about it.


You May Also Like

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More