From my understanding, jobs are pipelines started from a certain shell and you can manage these jobs (fg, bg, Ctrl-Z) from within this shell. A job can consist of multiple processes/commands.
My question is what happens to these jobs when the original, containing shell exits? Suppose huponexit is not set so background processes keep running after the shell exits.
Suppose I have done:
$ run.sh | grep 'abc' & [1] job_id Then I exit this shell. I'll enter a new shell and run jobs and see nothing obviously. But I can do ps aux | grep run.sh and see this process running and I'll also do ps aux | grep grep and see the process for grep 'abc' running too.
Is there a way to just get the job ID for the full pipeline so that I can kill it in one go, or do I have to kill all the processes separately from another shell once I have exited the original shell? (I have tried the latter and it works, but it seems like a hassle to keep track of all the processes.)