How to Pause Linux Command Line Programs
With a CPU or RAM intensive program running in terminal, sometimes you need to be able to pause the program in order work on something else for a bit, like browsing the web.
All of this was done in BASH, other shells may or may not work.
Of course, programs like mencoder don’t usually come with a function to pause and resume their execution. Fortunately, its easy to pause it through the shell.
Just hit ctrl-z
to suspend the program. This will bring you back to the terminal prompt, allowing you to run another program if you choose.
In order to resume the execution of the program, type fg
(for foreground). If you want to resume the execution, but this time have it run as a background process, instead enter bg
(for background).
If you’ve backgrounded the process by accident, it’s easy to recover it. Simply type fg
, then the job number (which is specified in square brackets when you background the job). So, for job 1mid, I would type fg 1
to bring it back to the foreground.