I want to output a time of modification of files including year and seconds. I tried to use ls -linT, means -T must do it, but it doesn't. -T is recognized as tabulation size. I'm searching a solution using ls. Could someone help me, please?
To sort by time in Linux ls command, we can use the -lt option. These two options will cause ls to sort files by modified time, with the most recently modified files appearing first and output is in long format. -t Sort by descending time modified (most recently modified first).
ls -s: list the files along with their size. ls -t: sort the list by time of modification, with the newest at the top. ls -S: sort the list by size, with the largest at the top. ls -r: reverse the sorting order.
Modified Time. The modified timestamp contains the time the file's data has been changed. It means when we make changes to the actual contents of the file, the file system will update the modification time.
To see the access time for a file with ls , append the -u option in your command. In this case, our access time is the same as the file's modified time, which is normal for files that have not been accessed since they were last saved.
Try --time-style=full-iso
, or just --full-time
:
ls -l --time-style=full-iso
ls --full-time
From man-page:
--time-style=STYLE with -l, show times using style STYLE: full-iso, long-iso, iso, locale, +FORMAT. FORMAT is interpreted like
date'; if FORMAT is FORMAT1<newline>FORMAT2, FORMAT1 applies to non-recent files and FORMAT2 to recent files; if STYLE is prefixed with
posix-', STYLE takes effect only outside the POSIX locale
So you can also have a format specifier (see date
man-page for format string):
ls -l --time-style=+"%Y %H:%M:%S"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With