Change ls datetime format - how?

Bo Berglund bo.berglund at gmail.com
Fri Feb 12 15:17:15 UTC 2021


On Sat, 6 Feb 2021 12:33:09 +0100, Tom H <tomh0665 at gmail.com> wrote:

>How about "--time-style=long-iso"?
>
>If that's not good enough, you can specify your own style with
>"--time-style=+...", where "+..." is a "date" like format.

$ ls -l --time-style=full-iso
-rw-rw-r-- 1 bosse bosse 176876969 2021-02-01 13:32:01.889138171 +0100 Joe.mp4
Too long seconds output!

$ ls -l --time-style=iso
-rw-rw-r-- 1 bosse bosse 176876969 02-01 13:32 Joe.mp4
No year display!


This is what I put into ~/.bashrc as alias for ll :
$ ls -al --time-style="+%Y-%m-%d %H:%M"
-rw-rw-r--  1 bosse bosse 176876969 2021-02-01 13:32 Joe.mp4

I also have this in .bashrc asa lls to get the seconds:
$ ls -al --time-style="+%Y-%m-%d %H:%M:%S"
total 6419824
-rw-rw-r--  1 bosse bosse 176876969 2021-02-01 13:32:01 Joe.mp4

The use of long-iso seems to work like %H:%S but will not show seconds..

So I will stick with the aliases I have.


-- 
Bo Berglund
Developer in Sweden





More information about the ubuntu-users mailing list