How can I install GNU Parallel alongside Moreutils on Ubuntu/Debian?

For Ubuntu v17.04 ("Zesty Zapus") and Debian v9 ("Stretch"), (2017 or newer), or distros based upon those versions, please read Bryan Larsen's answer first, which should be sufficient.

For versions from before 2017, read on...


Use dpkg to force the install; parallel gets along nicely with moreutils -- it renames moreutils' parallel util to parallel.moreutils. When the install is done both programs (GNU and moreutils) are available.

NB: if any user scripts call the old moreutils parallel, change those scripts to use the longer name.

Details: Fetch parallel package (without installing or removing anything). Then using compgen, (a bash internal command), find parallel package in archive. If there's more than one, use the latest. Force that package to install, despite conflicts.

apt-get --assume-yes --download-only install parallel &&
ls --sort=version $(compgen -f /var/cache/apt/archives/parallel) |
    tail -n 1 | xargs dpkg --force-conflicts -i

How to view the resulting diversions:

dpkg-divert --list 'par*'

Output:

diversion of /usr/share/man/man1/parallel.1.gz to  /usr/share/man/man1/parallel.moreutils.1.gz by parallel
diversion of /usr/bin/parallel to /usr/bin/parallel.moreutils by parallel

See how both binary executables are available:

compgen -c parallel | xargs which | xargs ls -l

Output:

-rwxr-xr-x 1 root root 240814 Oct 31  2014 /usr/bin/parallel
-rwxr-xr-x 1 root root  10592 Jul 21  2015 /usr/bin/parallel.moreutils

This conflict is solved in Ubuntu 17.04 and Debian Stretch.

If you install parallel & moreutils you get the GNU parallel as /usr/bin/parallel and moreutil's parallel as /usr/bin/parallel.moreutils. If you only install moreutils, it provides /usr/bin/parallel.

If you're using an older version of Ubuntu or Debian, you could download and install the .deb's from a newer version: they install & work just fine.