Skip to content

TIME_STYLE format is implemented backwards #12676

@mixmastamyk

Description

@mixmastamyk

The TIME_STYLE format of ls seems to be implemented backwards, see #3625.

The docs say:

+FORMAT is interpreted like in date(1).
If FORMAT is FORMAT1 NEWLINE FORMAT2,
then FORMAT1 applies to non-recent (old) files and FORMAT2 to recent files.

In other words: OLD \n NEW.

I set the old_file file below to be very old with touch,
and then foo and foo2 with the time now.

I'm expecting the old ones have ISO 8601 format, while the new ones have a "human" format.

⏵ ls --version
ls (GNU coreutils) 9.7
...

⏵ command ls -a -l --time-style='+ %Y-%m-%d %k:%M
                     %a %b %d %k:%M'
-rw-r--r--  1 username username 3771  2001-01-01 12:00 old_file
-rw-rw-r--  1 username username    0  Sat Jun 06 18:29 foo
-rw-rw-r--  1 username username    0  Sat Jun 06 18:32 foo2

# correct: old files are iso, recent files are human style


# switch
⏵ sudo apt-get remove coreutils-from-gnu --allow-remove-essential
...


⏵ ls --version
ls (uutils coreutils) 0.8.0

⏵ command ls -a -l --time-style='+ %Y-%m-%d %k:%M
                     %a %b %d %k:%M'

-rw-r--r--  1 username username 3771  Mon Jan 01 12:00 old_file
-rw-rw-r--  1 username username    0  2026-06-06 18:29 foo
-rw-rw-r--  1 username username    0  2026-06-06 18:32 foo2

# backwards: old files are human, recent files are iso

Edit: forgot to mention this is on Ubuntu 26.04. Also changed bashrc filename to "old_file" for readability reasons.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions