Disclaimer: This article is a blogger sigmarising original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/sigmarising/article/details/90036504
Use the screen command on Linux to run programs in the background
When we use ssh to log in to the Linux server, you may need to perform some long-running program, this time we will be able to use the screen commands.
Scene analysis
We need to run a deep learning task that requires GPU servers running 30 hours.
Our steps are as follows:
- ssh to log in to the server GPU
- Configure your venv / conda environment
- Transmission code file
- Excuting an order
screen -S <name>
- Activation python in a new session venv / conda environment
- Run deep learning task
- Use keyboard shortcuts
Ctrl + A + D
to temporarily leave the session - Already disconnected ssh connection, and after the next time you log in, use
screen -r <name>
the restore session
You can be used screen -ls
to view all sessions