My Linux knowledge is rather rusty, so needless to say, I managed to frustrate myself by accidentally halting a running program (VMware Tools installer) by pressing CTRL+Z whilst working on one of our Ubuntu Server installs (12.04) the other day.
So as a quick reminder to myself more than anything else, here is how to get back control, or start if you will, a halted program (job in this particular parlance).
First, to see a list of all jobs, run:
You’ll see a list of all available jobs, with their ID on the left hand side of the listing. If you want to continue the halted program in the background (let it do its business and then switch back to it later), enter:
where [number] is the number identifier of the job the run in the background. Of course, you’ll probably actually want to have the program back in the foreground (like I needed to), which in that case meant I had to run:
Easy as that. For quick reference, here is a list of general job control commands available to you:
- jobs – list the current jobs
- fg – resume the job that’s next in the queue
- fg %[number] – resume job [number]
- bg – Push the next job in the queue into the background
- bg %[number] – Push the job [number] into the background
- kill %[number] – Kill the job numbered [number]
- kill -[signal] %[number] – Send the signal [signal] to job number [number]
- disown %[number] – disown the process(no more terminal will be owner), so command will be alive even after closing the terminal.
Useful to know.