3

I read a few guides online that explain how to use the command last to have a list of user logins.

One of the easiest command is:

last -s yesterday -t today

which should show the list of logins from yesterday till today. But when I execute this command on a Mac I receive an:

last: illegal option -- s
usage: last [-#] [-t tty] [-h hostname] [user ...]

This is not how it is supposed to work.

Why -s is not recognised?

2 Answers 2

7

man last

Always use man X directly on the Mac itself to see what is available for command X. The reason is that OS X was originally based on BSD and not GNU (most likely to avoid the GPL) so you should not follow Linux tutorials for MacOS.

3

The 'last' command on a Mac has no -s option. Not all Unix commands are implemented the same on a Mac. Mac tends tends to use original BSD commands. As to why 's' isn't an option on the Mac, according to @Mark, it may be due to the difference in BSD (Mac) and GNU (Linux). There are most likely differences between the two.

1
  • First part OK. Second part is incorrect. Mac uses BSD commands. GNU, which is what Linux uses, often adds extra non standard options, BSD tends to stick to the older options, So upto BSD and GNU why options differ, not really Apple's choice
    – mmmmmm
    Commented Sep 27, 2019 at 16:46

You must log in to answer this question.

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