Modern supplements for existing Linux tools (and some totally new ones)

Some Linux tools get the job done but are starting to feel a bit creaky. Lately there has been a push to create new tools that:

  • Have sane defaults (e.g. implied wildcards when performing searches)
  • Are written in safer languages (e.g. Rust)
  • Take advantage of multiple cores (e.g. GNU Parallel, fd)

I often come across these things and get excited about them but there are so many that I start to lose track. Here I'll keep tabs on some of the ones that I've found, and some notes about my experiences with them.

BTW, I refer to these tools as supplements instead of replacements because I think each tool has its niche. Also, while I might use these tools on my own system, if I write a script for wider deployment I usually fall back to the standard "old" tools for compatibility reasons.

fd: Supplement for find (and xargs and GNU Parallel)

No more find . -iname "*scriptname*" ! Replace that old syntax with something simpler like this:

fd scriptname

What else does it do?

  • It traverses directories in parallel so it should be faster than find on systems with SSDs or other very fast disks
  • Supplements xargs: It has a feature like find's -exec to run commands against the files it finds. This command finds all zip files in and under the current directory and unzips them.
  • fd -e zip -x unzip
  • Supplements GNU Parallel: Running commands against files can be done in parallel. The unzip command above will be run in parallel when the files are found fast enough.

Is it worth it?

In my tests, yes! hyperfine benchmarks show me a massive speed improvement even on spinning disks.

Finding *.rbxlx files on my system with find takes about 7 seconds:

% hyperfine --warmup 3 'find . -name "*.rbxlx"'
Benchmark #1: find . -name "*.rbxlx"
  Time (mean ± σ):      7.852 s ±  0.448 s    [User: 219.8 ms, System: 2231.1 ms]
  Range (min … max):    7.178 s …  8.456 s    10 runs

Finding those same files with fd on my system takes about 330 milliseconds, a 21x improvement.

% hyperfine --warmup 3 'fd -e rbxlx'
Benchmark #1: fd -e rbxlx
  Time (mean ± σ):     331.6 ms ±  15.3 ms    [User: 591.2 ms, System: 1361.0 ms]
  Range (min … max):   318.2 ms … 371.9 ms    10 runs