Search code examples
ubuntuprocessterminalbackgroundforeground

Issue when moving process from background to foreground in Ubuntu Terminal


I started a couple of processes in the background from the terminal.

lars@UbuntuVM:~$ xeyes &
[1] 8553
lars@UbuntuVM:~$ xclock -update 1 &
[2] 8554
lars@UbuntuVM:~$ jobs
[1]-  Running                 xeyes &
[2]+  Running                 xclock -update 1 &

The task is to bring one of them to the foreground, suspend it, and then bring it back to the background. However, when I bring one of them to the foreground, I am unable to enter any new commands. If I enter ^C, it just terminates the process all together.

lars@UbuntuVM:~$ fg %1
xeyes
How
do
I
get 
back
from
here?

So How do I proceed to suspend the current process when moved to the foreground?


Solution

  • The correct key combination to be used for sending a foreground process to the background is ^Z, not ^C. For more details, see the Bash manual on job control.