1

I'm a little bit surprised on Ubuntu and Cent OS, the last -t actually behaves as showing logins up till the time specified, as opposed to as of the time specified as stated in its man page.

Here is what the man page on Ubuntu says:

-t YYYYMMDDHHMMSS
          Display the state of logins as of the specified time. This is useful, e.g., to determine easily who was logged
          in at a particular time -- specify that time with -t and look for "still logged in”.

However, the actually behavior looks something like this:

# last -F -t 20150107000000 | grep pts
root pts/2 jp001.solidtunne Tue Jan 6 18:39:05 2015 - Tue Jan 6 18:40:34 2015 (00:01)
root pts/2 jp001.solidtunne Tue Jan 6 18:37:24 2015 - Tue Jan 6 18:37:41 2015 (00:00)
root pts/2 jp001.solidtunne Tue Jan 6 16:42:33 2015 - Tue Jan 6 16:43:49 2015 (00:01)
root pts/2 jp001.solidtunne Tue Jan 6 13:03:26 2015 - Tue Jan 6 13:07:02 2015 (00:03)
root pts/2 jp001.solidtunne Tue Jan 6 09:03:24 2015 - Tue Jan 6 09:03:54 2015 (00:00)
root pts/2 jp001.solidtunne Tue Jan 6 04:53:54 2015 - Tue Jan 6 04:54:07 2015 (00:00)
root pts/4 sf003.solidtunne Fri Jan 2 15:23:12 2015 - Fri Jan 2 15:23:51 2015 (00:00)
root pts/0 hk000.solidtunne Thu Jan 1 16:40:55 2015 - Thu Jan 1 16:41:21 2015 (00:00)
root pts/2 hk000.solidtunne Thu Jan 1 15:41:52 2015 - Thu Jan 1 15:42:02 2015 (00:00)
root pts/4 hk000.solidtunne Thu Jan 1 11:24:56 2015 - Thu Jan 1 13:40:40 2015 (02:15)
root pts/4 hk000.solidtunne Thu Jan 1 11:24:34 2015 - Thu Jan 1 11:24:48 2015 (00:00)
root pts/0 hk000.solidtunne Thu Jan 1 08:31:13 2015 - Thu Jan 1 08:31:25 2015 (00:00)

The current date is as follows:

# date
Thu Jan 8 08:12:32 UTC 2015

And Ubuntu version:

# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.1 LTS
Release:    14.04
Codename:   trusty

Kernel:

# uname -a
Linux install 3.13.0-40-generic #69-Ubuntu SMP Thu Nov 13 17:53:56 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

I have opened a bug in Ubuntu's bug system: https://bugs.launchpad.net/ubuntu/+source/sysvinit/+bug/1408605 . However, it seems people are not interested in this bug, and I barely got any information about this bug from Google. I am now confused, am I missing anything?

1

I believe the bug is simply a documentation bug.

Ubuntu 14.10's version of util-linux (which is where last comes from) is 2.25

Fedora 21's version of util-linux is also 2.25.

The man page for last on Fedora states:

   -t, --until time
          Display the state of logins until the specified time.

which is what you get as the actual behaviour.

I suggest you raise a bug against util-linux on Ubuntu (or Debian) and CentOS for the man page.

  • It would be sad if this is a documentation bug, because I think as of is more, at least equally useful than 'until'. Actually I need to get the most recent login items from this list. If this is the case, there seems to be no easy way to get a list of the most recent login items. – Elgs Qian Chen Jan 11 '15 at 11:57
0

Problem solve by downloading the last.c. Go to line 753, change the line from:

if (until && until < ut.ut_time)
  continue;

to

if (until && until > ut.ut_time)
  continue;

then recompile it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.