Globs sort filenames character by character, so numbered files often come out in a surprising order, with 10 before 2. Zsh has a neat fix for this: the nglob qualifier, which applies a “natural” sort, treating any run of digits as a number rather than a string of characters.
Got a directory that you want to tidy up bloat from? Whether you’re trying to find bad build artifacts in your work repository or clear out old cat videos from your home directory, Zsh’s (OL)glob qualifier can help you find the largest files.
Zsh modifiers are a family of suffixes that transform words as they’re expanded. Several of them are dedicated to slicing up filenames, replacing fiddly calls to dirname, basename, and friends. Let’s take a look at them now!
Zsh glob qualifiers can select files by many built-in attributes: type, size, modification time, and more. But when no built-in qualifier fits, you can bring in the e or + qualifiers to run arbitrary code, making globs a fully programmable file filter. With great power comes great responsibility!
My downloads directory is a junk pile that I just never get around to fully clearing. So if I’ve just downloaded a bunch of files, I normally want to work with them and ignore the rest of the files.
I’ve recently been using memray, a memory profiler for Python, to optimize the startup memory usage (and time) for a client. It’s a fantastic tool, but its flexibility hampers getting instant feedback. It takes three commands to profile a program, generate a flame graph from the profile, and open the flame graph in the browser: