Recipes
Five jobs this tool does every day. Each was run for real in the lab (transcripts noted); each scales from a dozen files to ten thousand without changing shape.
Checksum every file in a tree
From transcript t04:
ls samples/*/*.txt | parallel sha256sum {} > checksums.txt
Any list-printing command can feed it —
find . -name '*.iso' is the usual one.
Add --joblog when the run matters
(chapter 9), and -k when a human will
read the list in order.
Compress a folder without destroying the originals
From transcript t06 (-k here is
gzip's own "keep the original" flag,
not parallel's):
parallel --dry-run gzip -k {} ::: samples/north/*.txt
parallel gzip -k {} ::: samples/north/*.txt
The dry run first, always — it costs a
second and shows every command before
one runs. The same shape works for
xz, zstd, or bzip2.
Turn each file into a derived file
From transcript t07 — upper-case copies
of six notes, into a separate folder,
names built from {/.}:
parallel 'tr a-z A-Z < {} > upper/{/.}.upper' ::: samples/south/*.txt
The pattern to keep: input from {},
output named from {/.} plus a new
ending. It is also the shape of the
classic conversion job, which reads the
same with a converter in the middle:
parallel convert {} {.}.jpg ::: *.png
(ImageMagick was not part of this guide's lab; the pattern is the lab's, the converter is yours to supply.)
Rename in pairs
From transcript t05b. Two lists, walked
in step with :::+, never combined:
parallel mv {1} {2} ::: draft-one.txt draft-two.txt :::+ final-one.txt final-two.txt
Dry-run it first. A paired rename with
the lists in the wrong order is the
fastest way to scramble a folder, and
--dry-run is how you see it coming.
Summarise every file, one line each
From transcript t07:
$ parallel wc -w {} ::: samples/*/*.txt
44 samples/north/notes-01.txt
45 samples/north/notes-02.txt
...
Any per-file reporter drops in here —
identify for images, ffprobe for
media, pdfinfo for PDFs. The output is
a table you can sort, total, or grep,
and because parallel keeps each job's
output together (chapter 8), the lines
never tear.
The recipe behind the recipes
Every one of these is: a list, a template with the pieces cut by replacement strings, a slot count, and a dry run first. When a new job appears, assemble those four and you have it.