Tuesday, August 02, 2011

Changing Linux/Unix "ls" Time Format

I though I had documented this, but had to look it up again today. To change the format of the the ls command's time, use:
ls -l --time-style=+%s
...where the format is the same as those listed for the date command. See man date. I like +%s, because it allows scripts to calculate "elapsed time" between two file modifications.

Another useful option --time to display atime or ctime rather than mtime.

No comments:

Post a Comment