sort -r reverses the sort. What it is reversing depends on collation rules that vary by environment.
Byte order versus linguistic order
Under LC_ALL=C, sorting compares bytes: every uppercase letter precedes every lowercase one, so Zebra sorts before apple. Under a typical locale, collation is case-insensitive and language-aware, so apple precedes Zebra. The same command on two machines produces two different orders.
Why this breaks pipelines
comm and join require their inputs sorted in the same order they use for comparison. Sorting under one locale and comparing under another produces silently incorrect results. Set LC_ALL=C explicitly for any sort feeding those tools โ deterministic beats linguistically correct when the consumer is another program.
Reverse sort is not reversed output
sort -r sorts descending; tac reverses line order. On data with duplicate keys the two differ, because sort -r may reorder equal elements. sort -s forces a stable sort where the original relative order of equal keys matters.
Try it: Sort Z to A on SeoWolf's Notepad.