Are the Mac OS X GUI and a Terminal session peers?
Solution 1
Someone with more knowledge about this can feel free to correct me here!
s001
is your TTY. It's the terminal you're connected to the machine via.The GUI is, as you said, a means of logging on to the server, and therefore it shows as
console
. It does havestdin
,stdout
, andstderr
stdin is typically NULL. stdout and stderr go to the console log, in
/Library/Logs/Console/*your_uid*/console.log
Solution 2
The "console" does indeed refer to the primary session of an OS X machine. It doesn't need to be graphical. Try entering >console
as your username at the login window some time.
Related videos on Youtube
xyz
Updated on September 17, 2022Comments
-
xyz over 1 year
I'm trying to get to grips with UNIX.
If I open up a Terminal in Mac OS X and run
w
, I seeUSER TTY myusername console myusername s001
(I don't know if "session" is the right term)
I assume that
s001
is my Terminal session. Doesconsole
represent the entire Mac OS X GUI's session?The GUI session is obviously fancier and more complex, but is it a peer to the Terminal session conceptually?
What are the GUI session's stdin / stdout / stderr hooked up to?
-
Admin over 5 yearsSee also unix.stackexchange.com/questions/480763 .
-
xyz over 14 yearsSo does "console" mean the first session? Or is it a special session reserved for the keyboard/screen that are physically attached to the computer? In UNIX in general, must there always be a "console" session open?
-
xyz over 14 yearsSo does console "own" ttys001 or are they peers as far as the UNIXy core is concerned?
-
macsit over 14 yearsIn OSX it's the physical terminal. I believe it's the same in some other UNIXes such as Solaris, but not so in linux. There you are allocated tty# depending on which of the physical terminals you log in to.
-
Chris Page over 12 years@f100: No.
console
andttys001
are both device names, listed in/dev
. The first line in thew
output is indicating that there's a login session with/dev/console
as its "controlling terminal". The second line indicates there's a login session with/dev/ttys001
as its controlling terminal. tty devices are normally opened in order, starting atttys000
. If you close all open terminals and open a new one, it will usually getttys000
, since it's free again. -
Chris Page over 12 years
console
is the name of the/dev/console
device. The first line ofw
output is indicating that there's a login session with/dev/console
as its controlling terminal. According tosudo lsof /dev/console
,launchd
has it open. I was under the impression that writing to/dev/console
just wrote to the console log file, but I haven't been able to verify it produces changes in any logs I examined. -
Chris Page over 12 years@f100: i.e., "no, console doesn't own ttys001". I suppose the answer to the second part of your question is "yes," insofar as they are both "merely" terminal devices connected to login sessions. However, the login session that has
console
as its controlling terminal is special in that that login session is created when you login at the Mac OS X login window.