0

A quick question. When do a ll command in unix, we get the file listing the timestamp at which it was modified/created. Usually it will be in the format of MMM dd HH:MM. How can i get this converted to epoch time?

For ex: ll abc.txt

Output: -rw-rw-r-- 1 maria_dev maria_dev 105 Mar 25 12:00 abc.txt

How can I convert this Mar 25 12:00 to epoch time.

Note: Here year is not being listed also

1
  • Do you want to convert a previous ls -l output, or change the time-style when ls -l is run? – steeldriver Mar 26 '20 at 14:55
3

If you’re using GNU ls, you can use its --time-style option:

ls -l --time-style=+%s
1
  • Or TIME_STYLE=+%s ls -l also. – Isaac Mar 26 '20 at 21:42

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.