Use the disown shell builtin to exit the shell but continue running already back grounded jobs. The syntax changes from shell to shell.

zsh

disown [ job ... ]

bash

disown [-ar] [-h] [jobspec ...]

Example:

foo &
disown %1
exit

Relevant commands:

ps xao pid,ppid,comm | grep foo
ps aux | grep NNNN

Ref:-

Note:- To attach a disowned job, the instructions in https://unix.stackexchange.com/questions/31824/how-do-i-attach-a-terminal-to-a-detached-process might be helpful. But I have not tried them.

tags | continue running the jobs in the background, detach