Feedback

type to search

By: Asked from United States of America

Running Commands in Background?

Hey… I’m doing so many works sometime, and sometimes it’s not in a way I can use tabs or different shells… Is there a way I can run some commands like upgrading in background?

4

rhonda [ Editor ]

What you are looking for is called job control. With ^Z (control z) you can suspend a running job, and with "bg" you then can send the process into the background. When you enter "jobs" you can see process list and their state. To bring one of the processes in the background into the foreground again (because maybe it waits for user input or such) you can do "fg x" where you replace x with the number of the job (written in square brackets before the command name).

To start a job directly in the background you can add a & at the end. As an upgrade process usually wants confirmation the ^Z and bg approach is better suited than starting it right off with &.

And yes, screen is really worth exploring, you should get used to it, especially when you work on remote servers and might lose network in the middle of a build process or similar. 

NN comments
goacid
-

I agree, screen is always the best solution for daily admin task (no background task).

or Cancel
You need to join Debian to complete this action, click here to do so.