Getting login year data with the 'last' command on linux

Solution 1:

man last
...
       -F     Print full login and logout times and dates.
...

So, use last -F

Solution 2:

On RHEL5, last -F isn't available.

If you want to have only the last informations from a specific year, you need to use last -t.

ex:

  • last -t 20140101000000 show everything before 2014.
  • last -t 20130101000000 show everything before 2013.

if you run a diff between the 2 commands, you can have only informations for 2013.

See Getting "year" with last command on Red Hat 5 for more informations if needed.