コマンド例
ls -og --full-time ${FILE_PATH} | awk '{ print $4,$5 }'
備考
ls --full-time
で詳細な作成日時が標準出力される。
標準出力の内容をより簡潔にしたいため、オプション「-og」を付与している。
# ls -og --full-time test.txt -rw-r--r-- 1 8 2020-03-03 11:55:46.314806129 +0900 test.txt
awk '{ print $4,$5 }'
で日時のみを取得している。
時間の地域まで取得したい場合は、「$6」を追加することで”+0900”を取得できる。
# ls -og --full-time test.txt | awk '{ print $4,$5 }' 2020-03-03 11:55:46.314806129