Questions tagged [last]
`last` is a command that shows a listing of the last logged in users.
93 questions
2 votes
0 answers
123 views
How to prevent user's logins to be added to /var/log/wtmp?
Is there a command or config option to prevent adding the logins of a specific user to /var/log/wtmp? Furthermore I noted, that last doesn't display all ssh "sessions" (e. g. when not ...
1 vote
4 answers
330 views
Why does lastlog show every user as never having logged in?
When I run lastlog the output shows every user on the system as **Never logged in** me@me-Z370-HD3P:~$ lastlog Username Port From Latest root ...
1 vote
1 answer
207 views
How to get user last login datetime as an ISO 8601 compliant date or timestamp?
I'm running zsh (version 5.9 x86_64-apple-darwin22.0) on macOS (Ventura 13.6.3). I want to figure out if a given user has logged in during last X days. To accomplish this, I want to get the last login ...
1 vote
1 answer
623 views
Get total time system has been used today - in minutes
I want to set a daily limit as to how long my computer can be on in a single day. In order to do so, I'm writing a cron script that will take appropriate action when certain milestones are reached (...
0 votes
1 answer
128 views
How to loop trough wtmp and extract certain data?
I am using the following command to save wtmp (last command) to a logfile: last -F | grep -i -e pv -e nv -e pp > last.log Result: I want to extract the username (first block) and the time of ...
0 votes
2 answers
714 views
Last logins during last hour
OK, so basically I'm trying to give a specific date and time and I want to see all the logins that were made during the hour range, e.g. last hour or two last hours from the time and date given. I ...
0 votes
1 answer
381 views
Missing shutdown entries in wtmp despite graceful reboots
Linux system with kernel 4.14.76 and last from util-linux 2.35.1. I am using last -x reboot shutdown to detect abrupt shutdowns and power loss. To my understanding, a clean reboot should show as a ...
1 vote
0 answers
273 views
Use `last` command to show non-interactive sessions
We use the command last to show if other users connected to an embedded system. For interactive ssh-sessions this works fine. But we use MATLAB GPU coder which provides build code to embedded system. ...