How do I get the name of the active user via the command line in OS X?
Via here
Checking the owner of /dev/console seems to work well.
stat -f "%Su" /dev/console