A Few More Command Line Utilities

I recently wrote about some useful command line utilities, and here are a few more I either forgot to add, or just discovered.

fd

I've never liked the find command. It's clunky to use, and worst of all often prints out hundreds of permission error lines. A good replacement is fd, which is faster and much nicer to use. For example, here's a search for this website's name starting from the root "/" of this Linode using find and fd, passed through wc (which counts characters and lines):

stderr/stdout line count, 1,301 for find, 19 for fd

You can see that find printed out 1,301 lines in 2.5 seconds, while fd output only 19 in 1.5 seconds. All of those 19 are useful lines, while most of those 1,301 lines are telling me where I can't search.

By the way, notice the red lock 🔒 symbol in the terminal above? That's Starship (which I mentioned previously) telling me that the user does not have write permission inside the current directory.

delta

Both mercurial and git feature the diff command, which shows you the difference in content between the current files on disk and the most recent commit. This is very useful as a way to see what's changed before you make a new commit. delta is a tool that (amazingly) works with both (mercurial is the often forgotten redheaded stepchild) and supercharges the diff command. It's language aware (like bat which I mentioned before), and offers a side-by-side viewing option. I haven't used it much, but I'm optimistic it will prove useful.

delta diff side-by-side

duf

For showing what disks are attached, and how much free space there is, duf is a pretty replacement for df.

delta diff side-by-side

Dust

The command "du" is used to sum up the disk spaced used in a directory. Dust does the same thing, but faster, and shows a hierarchical and sorted view of what files and subdirectories are taking the most space. Of all the tools I've featured here, this is the one I'm least sure about. I could see using it on a remote computer, but on my Mac I think prefer using something like OmniDiskSweeper that has a nice GUI and allows you to delete things interactively.

delta diff side-by-side