There’s a little-known, but oh so useful, bash builtin called disown – We’ve all started a job that ends up taking way longer than anticipated, now you really wish you had backgrounded it to begin with, or had used Screen.
From the manpage:
disown [-ar] [-h] [jobspec ...]
Without options, each jobspec is removed from the table of active jobs. If the -h option is given, each jobspec is not removed from the table, but is marked so that SIGHUP is not sent to the job if the shell receives a SIGHUP. If no jobspec is present, and neither the -a nor the -r option is supplied, the current job is used. If no jobspec is supplied, the -a option means to remove or mark all jobs; the -r option without a jobspec argument restricts operation to running jobs. The return value is 0 unless a jobspec does not specify a valid job.
It’s important to understand that disown does’t work on pids or processes, but jobs.
Here’s an example
CTRL-Z
$ bg
[1]+ rm -rf millionsoffiles &
$ jobs
[1]+ Running rm -rf millionsoffiles &
$ disown %1
Keep in mind, you need to be using the Bash shell for this to work.