Everyone using unix in their job will once in a while have to run a long running process. Usually right before leaving the office to go to dinner. If you have to check on it later to make sure it finished right then you are stuck with redirecting the output to a file and look there later.
Much better solution: Use
It can do lots of things, but the main one in this context is allowing you to "detach" and "reattach" a terminal.
Start by just running screen:
Now you should have a new shell. Start some long running command and then press
ctrl-a d. (Hold down control and press a, let go of ctrl and press d).
You are now back at the original shell before you started screen. Logout or go home now.
ctrl-a is the "attention" command in screen. If you want to give the program you are running a ctrl-a you can press
ctrl-a a. You can remap the attention command to something else if you want.
When you are back at an internet connection you simply run
$ screen -x
to reattach your old session. There are other ways to reattach, but this one is the easiest. If you have multiple screens running it might say something like
$ screen -x There are several suitable screens on: 8762.ttyp9.g5 (Attached) 19775.ttyp9.g5 (Detached) Type "screen [-d] -r [pid.]tty.host" to resume one of them.
Then I can either run
screen -x 19775 to attach the detached screen or
screen -x 8762 to attach the screen that's already attached (another person on another computer maybe - remote pair programming!) (Bonus tip: You just have to type enough of the PID that it's unique, so in this example
screen -x 8 or
screen -x 1 would be enough).
Easy as pie!
One more trick before you go: In a screen you can press
ctrl-a c to create a new "virtual screen". Press
ctrl-a n (next) to move to the next virtual screen or
ctrl-a p to go to the previous screen.
man screen will give you many more magic keys. screen is such a great tool. Even when I work on small FreeBSD installations on a compact flash card for say Soekris boxes I install screen (but then I also often install perl)...