||
See originals: https://www.howtoforge.com/linux_screen
使用SSH连接服务器并进行长时间计算时,经常出现连接意外断开的情形,使得程序运行功亏一篑。为避免这种情况,可以将任务在后台运行。如此,screen命令就应运而生了。
1. 创建一个名为matlab的screen session:
screen -S matlab
2. 然后使用以 Ctrl a 开头的命令在session内进行操作:
Ctrl a c - Creates a new screen session so that you can use more than one screen session at once.
Ctrl a n - Switches to the next screen session (if you use more than one).
Ctrl a p - Switches to the previous screen session (if you use more than one).
Ctrl a d - Detaches a screen session (without killing the processes in it - they continue).
Ctrl a ? - 了解更多以 Ctrl a 开头的快捷键
F12,遍历各session,可用来代替Ctrl a n/p。
3. 恢复某一screen session.
1)列出各个session的名字:screen -ls
2)恢复名字为matlab的session:screen -R matlab (R 代表Reattach)
4.了解更多关于screen命令:man screen
5.任务执行结束,关闭screen session: exit
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-4-26 12:11
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社