📅 2015-Jan-27 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ date, ls, time ⬩ 📚 Archive
The date and time displayed by ls -l
can be changed to any format you want.
The default is:
$ ls -l
total 88
-rw-rw-r-- 1 joe joe 6 Jan 27 12:23 a.txt
-rw-rw-r-- 1 joe joe 522 Jan 27 12:22 haha.txt
-rw-rw-r-- 1 joe joe 80360 Jan 27 12:23 jump.pdf
To change the format of the date and time use the --time-style
option. Values that can be passed to it are long-iso
, full-iso
and iso
. You can also specify your own custom format as a string.
Here is how the different time styles look:
$ ls -l --time-style=long-iso
total 88
-rw-rw-r-- 1 joe joe 6 2015-01-27 12:23 a.txt
-rw-rw-r-- 1 joe joe 522 2015-01-27 12:22 haha.txt
-rw-rw-r-- 1 joe joe 80360 2015-01-27 12:23 jump.pdf
$ ls -l --time-style=full-iso
total 88
-rw-rw-r-- 1 joe joe 6 2015-01-27 12:23:08.309375574 +0800 a.txt
-rw-rw-r-- 1 joe joe 522 2015-01-27 12:22:59.773375414 +0800 haha.txt
-rw-rw-r-- 1 joe joe 80360 2015-01-27 12:23:32.693376032 +0800 jump.pdf
$ ls -l --time-style=iso
total 88
-rw-rw-r-- 1 joe joe 6 01-27 12:23 a.txt
-rw-rw-r-- 1 joe joe 522 01-27 12:22 haha.txt
-rw-rw-r-- 1 joe joe 80360 01-27 12:23 jump.pdf
Tried with: Ubuntu 14.04