Print a file's last modified date in Bash

后端 未结 10 2151
难免孤独
难免孤独 2020-11-29 18:01

I can\'t seem to find how to print out the date of a file. I\'m so far able to print out all the files in a directory, but I need to print out the dates with it.

I

10条回答
  •  青春惊慌失措
    2020-11-29 18:11

    Isn't the 'date' command much simpler? No need for awk, stat, etc.

    date -r 
    

    Also, consider looking at the man page for date formatting; for example with common date and time format:

    date -r  "+%m-%d-%Y %H:%M:%S"
    

提交回复
热议问题