用Cz从屏幕上分离

我像这样开始屏幕

$ screen 

我像这样在屏幕上运行测试

 $ bundle exec rake. # takes ten minutes to complete 

现在我要从屏幕上分离,

 $ Ca d 

但我更常用(肌肉记忆)来“Cz”进行分离。 我如何使用Cz而不是Ca d来分离?

它看起来并不那么困难。 你必须在里面创建~/.screenrc文件:

 bindkey "^Z" detach 

但是,除非您为suspend绑定另一个组合键(在这种情况下为Ctrl+K ,否则您将松开screen内的作业控制function:

 $ stty susp ^K 

绑定^Z suspend而不是detach 。 从man screen

  Ca z Ca Cz (suspend) Suspend screen. Your system must support BSD-style job-control. suspend Suspend screen. The windows are in the `detached' state, while screen is suspended. This feature relies on the shell being able to do job control. 

所以,在你的~/.screenrc

 bindkey "^Z" suspend 

然后你可以在bash中使用fg来恢复:

 $ screen [1]+ Stopped screen $ fg screen [screen is terminating]