When you're connected to a server via. ssh, you might have trouble running processes asynchronous. Following i wan't to show a few commands, which allow you to pause a process, move it to background, continue the process in back or foreground and let it even continue, when the shell closes.
All commands listed below:
jobs - shows all current processes.
bg %jobid - continue job in background.
fg %jobid - bring background process into foreground.
ctrl+z - in terminal shown as ^Z; pauses current process and moves it to background.
disown %jobid - removes the process from table of active processes.
First of all i show you how to start a process in background. It runs until it needs input from command line. To do so, you might type
cp extremelargefile ../ &.
[1] + suspended (tty input) cp extremelargefile ../ &.
When the process suspended and you wan't to continue it in foreground, on terminal, you might type
fg %jobid. To figure out the jobid you might type jobs. All current gets listed then.
A process is running, e.g. cp. There might be a situation that you copy a large file and forgot to add & to the command. So you're running the process in foreground. To suspend the process and bring it to background you might press
ctrl+z. When you wan't the process to ran further, type
bg %jobid. As already told, you can bring this process back to the front by typing
fg %jobid.
For example:
> cp extremelargefile ../
^Z
zsh: suspended cp extermelargefile ../
> jobs
[1] - suspended (tty output) cp extremelargefile ../
> bg %1
[1] - continued (tty output) cp extremelargefile ../
> fg %1
[1] + continued (tty output) cp extremelargefile ../