Useful Unix Utilities (23)

19 Name: Nameless : 2026/05/19 05:21

Please remember that GNU Parallel exists. GNU Parallel has completely replaced quite a few other solutions I have used over the ages. GNU Parallel is wonderful.
There are a lot of times when I will do a for loop on a bunch of files but like, I shouldn't even bother with that.

converting a bunch of video files?
$ ls *.mkv | parallel my-conversion-script.sh
(where my-conversion-script usually has some fucking ffmpeg command I do really often)

everything is done at maximum fucking speed

downloading a bunch of files?
$ parallel -j 4 wget < list-of-URLs.txt
replace 4 with however many files you want to download at once

{} is the default filename placeholder, so if you need to put it somewhere specific in your command, use that
eg,
$ parallel some-script.sh {} -o {}-converted.ext < files-to-process.txt

and there are nice features like getting the filename without the extension:
$ parallel some-script.sh {} -o {.}.ext < files-to-process.txt
Name: E-Mail:
Leave these fields empty (spam trap):
More options...
Verification: