Upgrading standard Unix tools to modern improvements

2 minute read

Here’s just a short information sharing, on how I recently upgraded a few of the most used common standard Unix tools that I use daily, to more modern alternatives that makes me a lot more productive!

  • Searching for text and patters
    • Old: grep
    • New: ripgrep (rg(1) on cli)
  • Searching for files
    • Old: find
    • New: fd
  • Viewing text files
    • Old: less (or some would use cat)
    • New: bat

What is nice about for example rg and fd is that they are very much faster than the older traditional tools. The experienced difference is huge! They also both respect .gitignore files excluding whatever the list from the search. Over the past 10 years as the software development industry as fully adopted git and we have more and more of our work distributed with git, most of my files in my file system are in some git repository. Not searching generated, compiled or cache files by default is just what is needed. These tools are adapted to make the most common use cases simple. With grep I would often do $ grep -nr search-text . to search recursively from the current directory and show line numbers of matches. With rg I can just do $ rg search-text.

The bat tool just makes it nice to get syntax highlighting when viewing a source code file, which was always a mess to set up with tools like less. I would still use the old cat for simple concatenation of texts though.

Note of caution; these tools can improve the everyday tasks but should most likely not be used in any scripting. For scripting, we should rely only on POSIX Portable Operating System Interface - a standard for Unix-like systems.




Leave a comment

Your email address will not be published. Required fields are marked *