Wulf's Webden

The Webden on WordPress

Grep Speed

| 0 comments

One of the (many) reasons I like to have access to a Linux style system for computer work is the venerable but mighty command line utility grep. For the longest time, I thought it stood for “Get Regular ExPression” but I’ve since learned that the term actually comes from “Global Regular Expression Print”, stemming from the editor command it started with (g/re/p). In its simplest form, it allows you to search a specified directory for a string of text but you can extend it in all sorts of ways both with the command line arguments (such as -i for ignore case or -R for also search recursively through all subdirectories) and with the power of regular expressions to define exactly what you are looking for.

Today I wanted to search for the use of a couple of keywords in some of the codebase I have access to in my new webdev role. I fired up a Windows Subsystem for Linux (WSL) terminal in one part of that and ran a simple grep command. It took a while, so I wondered about trying a similar search on my Debian Linux box. This is running Debian 12 from an external USB hard drive on my laptop, an older and, I assumed, less powerful set up than my main box. Shiver me timbers! The laptop returned results while WSL was still working on it. I then moved up a directory on the Linux machine and tried the same search again – that gave a lot more files to search and it was still done before WSL.

By this point, WSL was beginning to trickle out results but, having run the same grep command on Linux and got the results I hit Ctrl-C to cancel the Windows version. Clear Debian is a bit better at file system operations than Windows. That doesn’t surprise me although I am impressed just how much faster it ran even on older hardware. Anyway, I’ve got my results… time to do something with them.

Leave a Reply

Required fields are marked *.


This site uses Akismet to reduce spam. Learn how your comment data is processed.