Per the man pages we have the following description of the --numeric-sort option of the sort command.-n, --numeric-sort              compare according to string numerical valueI assume, by string numeric value, we mean comparing each string character consecutively by its ASCII value?The info pages read-n--numeric-sort--sort=numeric     Sort numerically.  The number begins each line and consists of     optional blanks, an optional - sign, and zero or more digits     possibly separated by thousands separators, optionally followed by     a decimal-point character and zero or more digits.  An empty number     is treated as 0.  The LC_NUMERIC locale specifies the     decimal-point character and thousands separator.  By default a     blank is a space or a tab, but the LC_CTYPE locale can change     this.     Comparison is exact; there is no rounding error.     Neither a leading + nor exponential notation is recognized.  To     compare such strings numerically, use the --general-numeric-sort     (-g) option.After reading both docs, I still do not see explicitly explained which collation order is used for the -n option.How does the --numeric-sort option differ from the default?  My naive guess would be that numbers take precedence over letters, but I am not reading this in the documentation.And which documentation states this explicitly, i.e. where could I have found this info by just looking up the documentation?
sort (difference between default and numerical option -n)
sort
By default sort sorts character by character using a locale specified sort order. Generally that's pretty close to ASCII order, but there may be some regional variations. From the man page:***  WARNING  ***  The  locale  specified  by the environment affects sort order.Set LC_ALL=C to get the traditional sort order that uses native byte values.Native byte value usually means by ASCII value, so digits come before uppercase letters which come before lowercase letters. But ordering is still character by character, so 10 comes before 2 because 1 comes before 2.When the -n or --numeric-sort option is specified, runs of digits are treated as numbers (not individual characters), and sorted numerically from smallest number to largest.The documentation is not entirely explicit on the details, so here are the rules of the -n flag derived experimentally:Lines that begin numerically are sorted by numeric value (smaller numbers come first)Trailing characters on numeric lines do not affect the numeric portion, but the trailing characters are sorted alphanumerically if the numeric portion is the same.Lines that begin non-numerically are sorted as if they were zero, and then by rule 2.Observe:$ printf %s\\n 2z 111 10 20b 20a aa2 aa10 | sort -naa10aa22z1020a20b111By Rule 3, lines aa10 and aa2 are treated as zeros, and sorted by the remaining characters (including the digits, which are considered characters).By Rule 2, lines 2z, 20a and 20b are treated as numbers and the trailing character only comes into effect when the numbers are the same.And by Rule 1, all lines that begin with a number are sorted by numeric value.Without the -n flag, sorting is done character by character where digit characters come before letter characters. Observe:$ printf %s\\n 2z 111 10 20b 20a aa2 aa10 | sort1011120a20b2zaa10aa2