How do I get the name of the active user via the command line in OS X?

前端 未结 12 1610
耶瑟儿~
耶瑟儿~ 2020-12-13 05:27

How do I get the name of the active user via the command line in OS X?

12条回答
  •  渐次进展
    2020-12-13 06:03

    I'm pretty sure the terminal in OS X is just like unix, so the command would be:

    whoami
    

    I don't have a mac on me at the moment so someone correct me if I'm wrong.

    NOTE - The whoami utility has been obsoleted, and is equivalent to id -un. It will give you the current user

提交回复
热议问题