Re:Ask HN: What's the best obscure but useful CLI tool?
by anthonyhn on Wednesday April 05, 2023 @03:50PM
(#35459517)
GNU Parallel is pretty useful. You can use it to run command line programs in parallel. For example, if you wanted to gzip compress all individual files in a directory and limit the number of jobs equal to the number of CPU cores on your machine:
ls | parallel --dry-run --jobs `nproc` 'gzip {}'
(Note you have to remove the --dry-run switch to actually run this, --dry-run only prints out the commands parallel will run, not actually execute them)
ls | parallel --dry-run --jobs `nproc` 'gzip {}'
(Note you have to remove the --dry-run switch to actually run this, --dry-run only prints out the commands parallel will run, not actually execute them)