当我启动 Terminal.app 到我的 OSX Mountain Lion 时,我使用以下选项来启动“屏幕”会话:
**~/.zshrc relevant option**
if [[ $STY = '' ]] then screen -UxR; fi # autoload screen
**~/.screenrc**
escape ^Bb
autodetach on
startup_message off # Turn off the splash screen
defscrollback 30000 # Use a 30000-line scrollback buffer
然后,当我启动终端并发出“who”命令时,我看到的是:
➜ ~ who
atma console Aug 2 09:59
atma ttys000 Aug 2 11:32
atma ttys002 Aug 2 11:32
第一行是默认的“ho-my-zsh”提示。
我很确定肯定有一个很好的解释,但出于好奇,为什么那里有 2 个 tty 而不是 1 个?如果我退出屏幕,使用“exit”命令,我会得到 1 个控制台和 1 个 tty:
Last login: Thu Aug 2 11:32:40 on ttys000
[screen is terminating]
➜ ~ who
atma console Aug 2 09:59
atma ttys000 Aug 2 11:32
这里不应该只列出‘控制台’吗?
谨此致以问候并感谢您的时间!
答案1
Mac 让您登录,并算作在 09:59am 登录到控制台设备;终端为当前用户启动登录 shell(在 ttys000 上,上午 11:32),屏幕在其虚拟终端内为当前用户启动登录 shell(在 ttys002 上,也是上午 11:32)。所以这似乎很正常。这应该可以解释为什么当您退出屏幕时,您仍然看到控制台和 ttys000 登录处于活动状态。您可能会喜欢这个简要说明和/dev/console/
控制台应用程序。