'fg' works on shell jobs IDs (not Unix PIDs). These values are local to a given shell process, meaning you can only fg a process in the shell that bg'ed it. The command 'jobs' will list the jobs running in a shell.
Not really. Consider that processes are a tree, where each spawned process is a branch off the process that spawned it. You're asking "how to I transfer a branch to a different part of the tree?", which isn't how things work.
If it's that you want to be able to put things in the background, close Terminal, and get those things back later, there are other ways (e.g.
screen) to do that...
This thread has been closed by the system or the community team.
You may vote for any posts you find helpful, or search the Community for additional answers.
foreground (man fg ?)
Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.