You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

kmosx: Fixing Sort Order in Finder List Views

Last modified: Mar 4, 2021 10:12 AM
0 603 Last modified Mar 4, 2021 10:12 AM
Disclaimer: Apple does not necessarily endorse any suggestions, solutions, or third-party software products that may be mentioned in the topic below. Apple encourages you to first seek a solution at Apple Support. The following links are provided as is, with no guarantee of the effectiveness or reliability of the information. Apple does not guarantee that these links will be maintained or functional at any given time. Use the information below at your own discretion.


OS X users may find that filenames sort in the Finder in ways they do not expect. This is because OS X uses different sorting rules than do Classic/OS 9, Unix (including Terminal), and pre-WinXP Windows systems. Practical examples are digit strings and first/last markers. Some basic info is here.

Digits: A fundamental change in OS X is that strings of digits are ordered according to their arithmetic value (alphanumerically) rather than by each digit individually (lexicographically). In the latter case (as in OS 9 or Terminal) a file called 11 comes before a file called 2, because (looking at the first digit of each) 1 < 2. In OS X, the file named 2 comes before 11, because (looking at all the digits together) 2 < 11. <br>
When a series of files has been given names including digits so as to sort properly in Classic/OS 9 or Terminal, it may show up in quite a different order in OS X. If this causes a problem, three possible fixes are:

a) Rename all the files to fit OS X conventions.

b) Work with the files only in Terminal or Classic.

c) Use a criterion other than "Name" to sort the files in OS X. One possibility is the Comments field, where you can enter appropriate data and then have list view sorted according to that field.

First/Last List Items: The standard way to get a file to sort at the top of the list in OS 9 is to put a space before its name, and to get it to sort at the bottom, a tilde or a bullet. In OS X both space and tilde/bullet put an item at the top of a list. To move a file name to the bottom, you can preface it with a Greek letter like mu (Option-m), omega (Option-z) or pi (Option-p).

For technical info on OS X sorting rules, see the Apple documentation and the Unicode Collation Chart (which forms the basis for Apple's own modifications).

In non-Unicode applications, sort order is also determined in System Preferences/International/Language/Customize Sorting.

If you want OS9/Classic to sort files with numbers in their names like OS X does, you can try the program Natural Order.

If you want Terminal to sort like OS X, you can try the command "sort -n +POS1 -POS2". Do "man sort" in Terminal for details of how this works.

OS 9/Terminal sorting will work like OS X's with regard to numbers if you make sure all digit strings in filenames have equal length, using zeros to pad the shorter numbers, e.g. 02, 11.



Do you want to provide feedback on this User Contributed Tip or contribute your own? If you have achieved Level 2 status, visit the User Tips Library Contributions forum for more information.
Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.