A
A
Artyom2018-02-23 01:34:49
linux
Artyom, 2018-02-23 01:34:49

How to programmatically find out the name of the user logged into the system on Mac OS, Windows, Linux?

Primarily interested in Mac OS

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Arman, 2018-02-23
@Arik

whoami?

D
doublench21, 2018-02-23
@doublench21

macOS/Linux:echo "$USER"

MacBook-Pro-doublench:Debug doublench$ echo "$USER"
doublench

P
piatachki, 2018-02-23
@piatachki

If the question is about Java, I guess the author wanted to see this
System.getProperty("user.name")

V
Vladimir Kuts, 2018-02-23
@fox_12

linux, macOS:
windows:
echo %USERNAME%

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question