Keep a process running after exiting SSH session

  • #  raspberry pi
  • #  linux
  • #  ssh
    1. In SSH, launch the process you wish to keep in background, for example
    cp -Rv /mnt/red/*.* /mnt/black
    
    1. Suspend the process by pressing Ctrl-Z.
    2. Resume suspended process in background by typing bg.
    3. Detach the process from SSH session by typing disown.
    4. Exit the SSH by typing exit.

    The process will continue running in background.

    🍭 Typing fg at step (3) will bring the process back to foreground.