I know the general idea of console, tty as here explains https://unix.stackexchange.com/questions/4126/what-is-the-exact-difference-between-a-terminal-a-shell-a-tty-and-a-con
But when run who
(using iTerm2) I got these and I don't understand the difference here. BTW, I open 2 tabs in iTerms
ws ➤ who
qiulang console Dec 5 17:47
qiulang ttys002 Dec 5 17:48
qiulang ttys004 Dec 6 10:41
Best Answer
The console is your physical computer and the various tty are virtual terminals.
Each tab or window of a terminal emulator like iTerm2.app or Terminal.app will connect to a different tty. MacOS works the same as this quote from one of the answers on your linked question:
It is more clear what is happening if you run who with
who -a
(to show all details) and if you also use the tty command (which returns the current terminal).An example
Here I rebooted at 13:20, left it on the FileVault password entry screen until 13:25 then opened a Terminal.app session at 13:29.
You can see the last logon was 13:25:54 on console (when FileVault unlocked startup disk) and Terminal.app is running on /dev/ttys000.
Next at 13:30 opened a iTerm2.app session:
You can see the last logon is shown to be 13:29:06 on ttys000 (when Terminal.app was opened) and iTerm2.app connected at 13:30 to /dev/ttys001.
who -a
showsIf you boot into single user mode and type
tty
you will see the result/dev/console
(who
is not available)