1

There's an option %y which state the last modification time %y time of last data modification, human-readable

BSD's stat could list verbose information as

    $ stat -x Foo
      File: "Foo"
      Size: 96           FileType: Directory
      Mode: (0755/drwxr-xr-x)         Uid: (  501/   me)  Gid: (   20/   staff)
    Device: 1,4   Inode: 8605007622    Links: 3
    Access: Thu Apr 12 10:28:45 2018
    Modify: Thu Mar 22 09:44:46 2018
    Change: Thu Mar 22 09:44:46 2018

What's the equivalent to %y in BSD stat?

2

On an OpenBSD system:

$ stat -f '%Sm' myfile
Apr 12 09:40:05 2018 

The %Sm format means "modification time (m), as a string (S)".

Without the S, you'll get a Unix timestamp:

$ stat -f '%m' myfile
1523518805

These are the equivalents of %y and %Y with GNU stat -c "FORMAT" apart from the slight difference in the %y format output.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.