Show the full timestamp of files
Show the full timestamp of every file with ls -l --full-time in GNU coreutils. It prints nanosecond precision and the zone, which ls -l hides.
ls -l shows a time that is rounded to the minute, or a year, and you need the exact modification time to compare two files.
touch -d '2026-03-05 14:09:26.123456789' stamp.txt
ls -l stamp.txt
ls -l --full-time stamp.txt-rw-r--r-- 1 root root 0 Mar 5 2026 stamp.txt
-rw-r--r-- 1 root root 0 2026-03-05 14:09:26.123456789 +0000 stamp.txt--full-time is the same as -l --time-style=full-iso and prints the date, time to the nanosecond and the numeric offset from UTC, as in the GNU ls manual. The default format switches between a time and a year depending on whether the file is less than six months old, which is why two listings from different days can look inconsistent.
It is GNU only. The ls on macOS and BSD does not know the option, and ls -lT is the nearest equivalent there. For a value you are going to use in a script, stat -c %y file prints the same time without parsing ls output.