Show Menu
Cheatography

GNU Parallel Cheat Sheet by

Quick Example Commands From Manual

Overview

GNU parallel is a shell tool for executing jobs in parallel using one or more computers.
It's a great replac­ement for xargs or find and can do amazing things.

http:/­/ww­w.g­nu.o­rg­/so­ftw­are­/pa­ral­lel­/pa­ral­lel­_tu­tor­ial.html
http:/­/ww­w.g­nu.o­rg­/so­ftw­are­/pa­ral­lel­/ma­n.html

This is just a sheet of quick example commands and a concise reference.

Example Commands

Compress all *.html files in parallel
 ­ ­par­allel gzip --best ::: *.html
Convert (via
lame
) all *.wav files to *.mp3
 ­ ­par­allel lame {} -o {.}.mp3 ::: *.wav
Delete pict{0..9­999­}.jpg files in parallel
 ­ seq -w 0 9999 | parallel rm pict{}.jp­g    # Runs rm 10,000 Times

 ­ seq -w 0 9999 | parallel -X rm pict{}.jp­g # Runs rm minimal times
 

Command Synopsis

parallel [options] [command [argum­ents]] < list_o­f_a­rgu­ments
parallel [options] [command [argum­ents]] ( ::: arguments | :::: argfile(s) ) ...
parallel --sema­phore [options] command
#!/usr­/bi­n/p­arallel --shebang [options] [command [argum­ents]]

Input Lines

{}
Unaltered input line (foo/b­ar.jpg)
{.}
Remove extension: foo/bar
{/}
Basename: bar.jpg
{//}
Dirname: foo/
{/.}
Basename w/o ext: bar
{#}
Sequence Number of Job
{%}
Job Slot Number
{n}
Argument from input source n or the n'th argument.
{n.}
Combo of
{n}
and
{.}
.
{n/},  {n//}, {n/.}
Other Combo's Available
{=perl expres­sion=}
$_ with = {}, $_ is output after eval.
                       
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          find Cheat Sheet

          More Cheat Sheets by cpriest