If you are using PowerShell prompt on Mac Terminal and want to know who is currently logged in, you can make use of the below commands,
Option 1: who command
PS /> who
code2care console Sep 14 10:58
code2care ttys000 Sep 14 10:58
code2care ttys001 Sep 14 10:58
Option 2: whoami command
PS /> whoami
code2care
Option 3: $env:USER command
PS /> $env:USER
code2care
Note: As PowerShell is not native to macOS, the command that works on PowerShell for Windows may not work and you will get an error.
PS /> (Get-WmiObject -Class Win32_ComputerSystem).UserName
Get-WmiObject: The term 'Get-WmiObject' is not recognized as a name of a cmdlet,
function, script file, or executable program.
Check the spelling of the name, or if a path was included,
verify that the path is correct and try again.

Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!