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

前端 未结 12 1600
耶瑟儿~
耶瑟儿~ 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:09

    whoami

    EDIT

    The whoami utility has been obsoleted by the id(1) utility, and is equivalent to id -un. The command id -p is suggested for normal interactive use.

提交回复
热议问题