awk '{print length($0)"\t"$0}' | sort -n | cut -f2- sorts shortest first. The considerations mirror the descending case with one addition.
Ties dominate a length sort
Far more lines share a character count than share a word count, so most of the output consists of tied rows in arbitrary order. Add a secondary key โ sort -k1,1n -k2 โ so the result is reproducible. Without it, the same input can produce different output on different runs or different machines.
Empty lines sort to the very top
A blank line has length zero and leads the output. That is either exactly what you wanted for a quality check, or a sign that the list needs cleaning before anything else happens to it.
Prefer the tool's own key extraction where available
sort cannot compute length itself, which is why the decorate step exists. Where the sort key is a field already present in the data, sort -k avoids the decorate and undecorate passes entirely โ two fewer processes and no delimiter to collide with.
Try it: Sort by Length (Shortest First) on SeoWolf's Notepad.