Albretch Mueller wrote: > but not all timestamps are formatted the same. You get them as, say, > "Mar 24 2004", but also as "Dec 26 09:55" (without the year!) and they > are (or seem to be) files in the same directory > ~ > Why would that be?
Because the original Unix ls command many years ago did this to compress the information give to you. If it is a recent file then you get the time down to the minute and the year is assumed to be the most recent year. But if the file is much older then you don't really care about the minute but you do care about the year. You are a human, this is the way humans talk. That is how the ls command has always been on Unix systems. If you don't like it then you can supply a ls option --time-style=STYLE or TIME_STYLE variable and change the format to your liking. But there is no need to guess at this. It is all documented. Start at the top node of the documentation. $ info coreutils 'ls invocation' Press the spacebar to page through the documentation until you get to the section "10.1.6 Formatting file timestamps" where all is documented. By default, file timestamps are listed in abbreviated form. Most locales use a timestamp like `2002-03-30 23:45'. However, the default POSIX locale uses a date like `Mar 30 2002' for non-recent timestamps, and a date-without-year and time like `Mar 30 23:45' for recent timestamps. A timestamp is considered to be "recent" if it is less than six months old, and is not dated in the future. And the documentation goes on to the formatting controls that affect the time format. Good stuff. Bob
signature.asc
Description: Digital signature