Gentoo Wiki


I like to have Gentoo on my home system compile when I'm off at work. I don't have a job that I have continuous access to a computer though, so keeping an ssh session open was not an option. I needed a way to start an emerge command and have it complete even after I logged out. After some searching the forums and Google, I found the answer, Screen!

After you've got your ssh daemon set up and NAT across your firewall so you can actually ssh home, emerge screen (It's a quick compile). Next as a user screen -S portage. This creates a screen session on the socket named 'portage'. Once inside this new shell you'll need to elevate your privileges. I do this with a sudo -s. I like to emerge sync && emerge -uavtND world and then walk away. While that's running you can to tell the Screen session to detach, with Ctrl+a d. This puts you back into your original shell. Whenever you want to check up on the progress you execute a sudo screen -r portage, which reattaches the screen on socket 'portage'. To end the Screen session, exit like any other shell.

Again, this is a much more powerful program, and this is just one common use of it.

See Also

You can also use the nohup command to achieve the same ends.

For example nohup emerge -u world & will start off a session and log all output to the file nohup.out.

If you want to watch what is happening just type tail -f nohup.out (ctrl-C to exit viewing).

You can log out at any time. When you log back in you can inspect nohup.out to see what has happened -- it's also a good trace if you need to file bug reports.

This is particularly useful when using ssh to access your home machine from work to do the updates while you're otherwise engaged ;-)

Retrieved from ""

Last modified: Sat, 23 Aug 2008 10:02:00 +0000 Hits: 8,314