In bash on mac, when trying to list recent bad logins, the lastb command is unrecognized, while it works fine on my Linux machine. Does it need to be installed or is it a different command for macs?

1 Answer 1


While there is BSD last for OS X which just shows successful logins, I do not know if there is a command that lists recent bad logins. You could use grep to display such information, like:
$ grep -E 'LOGIN FAILURE | authentication error for | BAD SU | incorrect password attempts' /var/log/system.log

"LOGIN FAILURE" = failed local logins
"authentication error for" = failed SSH logins
"BAD SU" = wrong password inputted when using su
"incorrect password attempts" = wrong password inputted when using sudo

Edit: util-linux features GNU/Linux last + lastb but I am not sure if it will run on Darwin (OS X)

You must log in to answer this question.

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