Bugzilla – Bug 136978
"last" does not print full time and date information -- unusable for parsing output
Last modified: 2005-12-05 18:05:31 UTC
The output of the "last" command does not include the year for in the login time and the time for other events (reboot times). Logout times only show the time field (presumably because formerly people would log out of their terminal sessions on the same day when they logged in). Example: od@blackberry:~> last [...] od pts/27 Tue Nov 29 11:32 gone - no logout od pts/22 Fri Nov 25 14:10 - 19:04 (1+04:54) od pts/18 Fri Nov 25 14:10 still logged in od :0 console Thu Nov 24 22:57 still logged in reboot system boot 2.6.13-15-ppc64 Thu Nov 24 22:56 (10+19:32) od pts/34 Thu Nov 24 20:11 - crash (02:44) root pts/0 goro.suse.de Tue Sep 20 14:34 - down (00:07) [...] AFAICT, the main advantages of this output format are compactness (it fits in most terminals) and that to some extend it is more readable (albeit inaccurate for the logout times). To make the output of "last" more accurate to the user and especially for parsing it from scripts, a different output format should be selectable that displays full time and date information. The attached patch introduces the new flag "-F" (for "full time"). The flag changes the output to this: od@blackberry:~> last -F [...] od pts/27 Tue Nov 29 11:32:28 2005 gone - no logout od pts/22 Fri Nov 25 14:10:06 2005 - Sat Nov 26 19:04:32 2005 (1+04:54) od pts/18 Fri Nov 25 14:10:06 2005 still logged in od :0 console Thu Nov 24 22:57:11 2005 still logged in reboot system boot 2.6.13-15-ppc64 Thu Nov 24 22:56:33 2005 (10+19:32) od pts/34 Thu Nov 24 20:11:45 2005 - crash (02:44) root pts/0 goro.suse.de Tue Sep 20 14:34:17 2005 - down (00:07) [...] Other options like -a, -d and -i work with option -F: od@blackberry:~> last -F -a -d [...] od pts/27 Mon Nov 28 17:54:14 2005 - Mon Nov 28 23:57:24 2005 (06:03) priv-od.home.suse.de od pts/22 Fri Nov 25 14:10:06 2005 - Sat Nov 26 19:04:32 2005 (1+04:54) 0.0.0.0 od pts/18 Fri Nov 25 14:10:06 2005 still logged in 0.0.0.0 [...]
Created attachment 59859 [details] patch implementing option -F (full time)
submitting to STABLE