1

Imagine this situation, I open an ssh session, in that session I start a process and put it on background, with & or ctrl+z, then I close this session. There is some way to open another session and put this process in the foreground? since the job don't exists anymore.

1 Answer 1

2

You have to use screen. For example you could start with:

#> screen -S system-upgrade
#> aptitude update && aptitude full-upgrade

[aptitude output here]

The you can press Ctrl+A and then D to detach the screen. From now on, you can re-attach the detached screen wherever you want on the same machine (e.g. another console, terminal, ssh session, etc.).

You simply need to type screen -r system-upgrade (where system-upgrade is just the leabel you originally gave to the screen).

#> screen -ls
There are screens on:
[SCREEN_PID].system-upgrade (Detached)

#> screen -r system-upgrade
[aptitude output here]
[new aptitude output from where you left detaching the screen]

Try it yourself, screen it's a really must-have package.

sudo aptitude install screen
2
  • Sorry, I took for granted that you were using a Debian-like distribution. Too much time spent on Askubuntu I suppose :)
    – Avio
    Sep 27, 2012 at 19:21
  • that's ok, I'm using fedora but I got the idea. Thanks
    – Gonzo
    Sep 27, 2012 at 23:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .