Skip to content

ls: ignore leading period when sorting by name #2101

@tertsdiepraam

Description

@tertsdiepraam

The GNU ls ignores the leading period when sorting by name. However, hidden files still get sorted before non-hidden files with the same name, so .a always appears before a.

Here is an example:

$ touch a b .a .b
$ ls -A            # GNU
.a  a  .b  b
$ uu-ls -A         # current uutils
.a  .b  a  b

Code is here:
https://github.com/uutils/coreutils/blob/master/src/uu/ls/src/ls.rs

Tests are here:
https://github.com/uutils/coreutils/blob/master/tests/by-util/test_ls.rs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions