-1

I need to get the details of the users logged in from last 6 months to analyze and to increase the cpu of my server. I'm tried the command last -a but it is not giving the complete results. Anyone please help me to get the details of users logged in from last 6 months.

Thanks in advance!

1 Answer 1

0

Newer versions

You can use -s option:

last -s  -6month

Display the state of logins since the specified time.

use -t to specify until another date if you like.

If you receive a message like:

wtmp begins Tue Apr ...

it means that "logrotate" has removed your log files so you don't have access to use them.

for older versions you should specify full time:

last -t 20170101000000
18
  • If I try that command with -s option, it is throwing error like invalid option
    – Harsha
    Jun 28, 2017 at 6:57
  • last: invalid option -- 's' and there no option -s in man page.
    – Harsha
    Jun 28, 2017 at 6:57
  • What is the output of last -V?
    – Ravexina
    Jun 28, 2017 at 6:58
  • Same as above. last: invalid option -- 'V'
    – Harsha
    Jun 28, 2017 at 7:00
  • Is this work for you? last --time-format=iso | grep "2017-0[0-6]"
    – Ravexina
    Jun 28, 2017 at 7:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .