1

I have a background job, say jobid 1, in a tab of gnome terminal. Can I move it to a another tab of genome terminal?

I understand that the shell process in the first gnome terminal tab is the parent of the background process. So am I to change the parent/owner of the background process?

I guess that it is the same regardless of a process to be moved is running background or foreground?

Do I need some identifiers of the tabs of gnome terminal, tty things?

I don't really know how to do the above. Just some guessing.

7
  • Have you tried using screen or tmux? Commented Dec 3, 2014 at 13:23
  • no. I haven't. . Commented Dec 3, 2014 at 13:24
  • I think this would already be addressed somewhere on U&L or on Ask Ubuntu, but here's a quick guide: unix.stackexchange.com/a/108984/70524, you can simplify the process by using byobu. Commented Dec 3, 2014 at 13:26
  • 1
    You cannot change parent of the process. The only difference is init process, which is the parent of every other process, and by disowning the process you change its parent to init, after that you cannot "reattach" the process to other parent. Commented Dec 3, 2014 at 13:27
  • And also reptyer (which looks like it needs screen or tmux, not sure though): github.com/nelhage/reptyr Commented Dec 3, 2014 at 13:29

1 Answer 1

3

You can start the process in screen, type screen (it will start new screen session), run any command just like in your regular shell, detach screen (by pressing Ctrla, then d) and attach to the screen from any other terminal tab by typing screen -r.

In this case the process's parent is screen, which is detachable / attachable from any terminal session, including remote SSH sessions.

1
  • Thanks. (1) WIthout screen or tmux or likes, is it unlikely to change teh terminal session for a running job? (2) I haven't formed the habit of always running any program in screen or tmux yet. Is it recommended to do so, or just for some special jobs? (3) I heard that a job not running in screen can always be put inside a screen session, right? Commented Dec 3, 2014 at 23:35

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.