您也可以使用屏幕實用程序,允許您在單個終端窗口或遠程終端會話內訪問多個單獨的終端會話。
這意味着您可以設置一個屏幕會話(使用您選擇的名稱),在其中啓動一個程序(例如使用&),從會話中分離並稍後重新連接。
啓動未命名的屏幕。
$ screen
要具有特定名稱使用創建一個新的會話:
$ screen -S backup
- 這些都命令創建一個新的持久的會話,你可以使用它作爲一個普通的終端窗口,即發出指令並運行腳本。
如果你想離開會話而不終止它,使用:
Ctrl+a d command (press and hold Ctrl, press and hold a, then press d) to detach from the session.
要查看runnging屏幕的列表:
$ screen -ls
到正在運行的屏幕連接到控制檯:
$ screen -R
當屏幕正在運行時,可以使用以下鍵組合,並將其連接到控制檯。所有關鍵組合開始於按壓控制和同時開始。
ctrl+a d - detach the screen, and let it run without user interface (as described above)
ctrl+a c - create a new terminal
ctrl+a A - set the name of the current terminal
ctrl+a n - switch to next terminal
ctrl+a p - switch to prev terminal
ctrl+a " - list the of terminals