Use the screen comand to initiate an interactive shell on a remote server that persists after you log out.

Example usage:
  1. ssh into remote server
  2. Start a screen session:
    screen
  3. Within the screen session, set off a long process that needs interaction e.g.:
    ftp user@example.com
    ftp> lcd Downloads
    ftp> bin
    ftp> mget largeFiles*
  4. Press Ctrl+A then Ctrl+D to exit the screen session
  5. Press Ctrl+D to logout of ssh
The FTP download will now complete on the remote server independently.

If you wish to reattach to the screen session, log back in to the remote server and list the available sessions using screen -ls:
screen -ls
There are screens on:
57869.pts-0.freenas (Detached)
56018.pts-0.freenas (Detached)


Reattach to the required session using screen -x for example:
screen -x 56018.pts-0.freenas

You can detach the session using Ctrl+A Ctrl+D as before

Linux tips home Linux home bavister.org home