7 Posts Tagged ‘zsh’

(All tags.)


Zsh: sort globs in natural order with the (n) glob qualifier

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 n glob qualifier, which applies a “natural” sort, treating any run of digits as a number rather than a string of characters.

Read more...

Zsh: find the largest files with the (OL) glob qualifier

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.

Read more...

Zsh: manipulate filenames with modifiers like :r (root) and :e (extension)

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!

Read more...

Zsh: select files with arbitrary code in (e) or + glob qualifiers

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!

Read more...

Zsh: list recently modified files with (m0) glob qualifiers

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.

Read more...

Zsh: select generated files with (om[1]) glob qualifiers

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:

Read more...

Zsh: clear the “You have mail“ message

Do you see this message when you open a new terminal session?

Read more...