The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,227 other followers

listing files with ISO 8601 time stamps on *n*x flavours

Posted by jpluimers on 2018/12/05

A (long!) while ago, I wrote about list date with seconds from ls command – Dev Shed that showed how to list the full ISO timestamp (including seconds) of files.

This is an update.

The previous post showed that you could use this statement to list all files with their full ISO timestamps (and therefore get both the seconds and milliseconds) on (open)SuSE Linux, Mac OS X and Cygwin:

ls -l --time-style=full-iso

What Linux and displaying dates in ISO 8601 format… : Little Green Delusions proposes are two solutions to make this more permanent:

alias ls='ls -l --time-style=long-iso'

or edit one of your profile files (he prefers /etc/profile.local, but that is system wide, so I usually prefer ~/.bash_profile) to add this line:

export TIME_STYLE=long-iso

The thing is: I do not always want to have ls -l show ISO 8601 dates. I like the way that ls-l lists timestamps for very old or future files:                

If the modification time of the file is more than 6 months in the past or future, then the year of the last modification is displayed in place of the hour and minute fields.

Besides, some – but not all – flavours of nx also allow some more specific ways of showing iso timestamps:

  • `ls -l -T` on Mac OS X
  • `ls -l -E` (full) or `ls -l -e`(long) on Solaris
  • `ls –full-time` on openSuSE

But I want to have it work the same at least on these flavours:

  • SuSE Linux
  • Mac OS X
  • Cygwin

So to make things more universal I’ve added these to my ~./bash_profile:

alias ls-8601='ls -l --time-style=long-iso'
alias ls-full-8601='ls -l --time-style=full-iso'

So now I can choose which format to use when.


There are various ways of showing time stamps:

  • regular
  • long-iso
  • full-iso

Depending on your nx flavour, there are different arguments to use each of them, but using time-style is common.

Setting some aliases makes it work the same everywhere.


via: list date with seconds from ls command – Dev Shed.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: