If you’re like most people, you’ll disconnect from your SSH session, only to realize that you lost all your work. Don’t panic! There are a few things you can do to keep your session running. First, make sure that your SSH client is configured to save its sessions. Many SSH clients have a “save session” option, and some even have a “save all sessions” option. If yours doesn’t, try looking for an extension or plugin that will do the job. Second, make sure that your SSH client is configured to reconnect automatically if it loses connection. Most SSH clients have a “reconnect on loss of connection” option, and some even have a “reconnect on startup” option. If yours doesn’t, try looking for an extension or plugin that will do the job. Finally, make sure that you’re not disconnecting too often. If you disconnect every few minutes, your session will eventually be lost. Try to keep your disconnects shorter than that so that you don’t lose too much work in the process. ..
You’ll need to make sure that screen is installed on the server you are connecting to. If that server is Ubuntu or Debian, just use this command:
Now you can start a new screen session by just typing screen at the command line. You’ll be shown some information about screen. Hit enter, and you’ll be at a normal prompt.
To disconnect (but leave the session running)
To reconnect to an already running session
To reconnect to an existing session, or create a new one if none exists
To create a new window inside of a running screen session
To switch from one screen window to another
To list open screen windows
There’s lots of other commands, but those are the ones I use the most.