In GNU Coreutils version sort, the following items have special priority and sort before all other strings (listed in order):
Example:
$ printf '%s\n' a "" b "." c ".." ".d20" ".d3" | sort -V . .. .d3 .d20 a b c
These priorities make perfect sense for ‘ls -v’: The special files dot ‘.’ and dot-dot ‘..’ will be listed first, followed by any hidden files (files starting with a dot), followed by non-hidden files.
For ‘sort -V’ these priorities might seem arbitrary. However,
because the sorting code is shared between the ls
and sort
program, the ordering rules are the same.