Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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
share|improve this answer
    
Sorry, I took for granted that you were using a Debian-like distribution. Too much time spent on Askubuntu I suppose :) –  Avio Sep 27 '12 at 19:21
    
that's ok, I'm using fedora but I got the idea. Thanks –  Gonzo Sep 27 '12 at 23:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.