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

DevFeed: [Zsh: sort globs in natural order with the (n) glob qualifier](<https://devfeed.tech/articles/zsh-sort-globs-in-natural-order-with-the-n-glob-qualifier-62975.md>)

Original publisher: [Read original article](<https://adamj.eu/tech/2026/09/30/zsh-n-glob-qualifier/>)

Author: Adam Johnson

Published: 2026-09-29T23:00:00Z

Content type: tutorial

Language: en

Sources: [Adam Johnson](<https://devfeed.tech/sources/adam-johnson.md>)

Topics: [Zsh](<https://devfeed.tech/topics/zsh.md>)

Tags: [zsh](<https://devfeed.tech/tags/zsh.md>)

## AI overview

The article explains how to use Zsh's n glob qualifier to sort filenames in natural numeric order. It demonstrates fixing the page order when combining numbered PNG files into a PDF with ImageMagick and mentions enabling natural ordering by default.

## Source excerpt

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 ...