$ ls -l --full-time make.sh -rw-------+ 1 AndreasB mkpasswd 5772 2015-02-12 11:35:54.323703100 +0100 make.sh $ perl -MPOSIX=strftime -le 'print strftime("%Y%m%d", localtime((stat shift)[9]))' make.sh 20150212 $ stat make.sh File: 'make.sh' Size: 5772 Blocks: 8 IO Block: 65536 regular file Device: 7a51ec0fh/2052189199d Inode: 12384898975415113 Links: 1 Access: (0600/-rw-------) Uid: ( 400/AndreasB) Gid: ( 401/mkpasswd) Access: 2015-02-12 11:35:54.323703100 +0100 Modify: 2015-02-12 11:35:54.323703100 +0100 Change: 2015-02-13 14:48:31.352376000 +0100 Birth: 2014-11-26 17:16:45.173977800 +0100 $ stat -c %y make.sh 2015-02-12 11:35:54.323703100 +0100 $ stat -c %x make.sh 2015-02-12 11:35:54.323703100 +0100
file date format
HowTo Format Date For Display or Use In a Shell Script