OSX - How to get the creation & modification time of a file from the command line

后端 未结 2 1503
走了就别回头了
走了就别回头了 2020-12-23 20:48

While solving some programming puzzle, I wanted to see how long it took me to write a solution to the problem. To do so, I thought it\'d be a good idea to compare the file c

2条回答
  •  醉话见心
    2020-12-23 21:08

    As you already identified, the real culprit was that vim resets all 4 datetime stamps.

    But to answer your original question, here is a stat formatting for Mac OSX that will clearly show the 4 datetime stamps (including Creation/Birth and Modify):

    stat -f "Access (atime): %Sa%nModify (mtime): %Sm%nChange (ctime): %Sc%nBirth  (Btime): %SB" file.txt
    
    Access (atime): Nov 16 19:44:55 2017
    Modify (mtime): Nov 16 19:44:25 2017
    Change (ctime): Nov 16 19:44:48 2017
    Birth  (Btime): Nov 16 19:44:05 2017
    

提交回复
热议问题