How to background a process: 2-Minute Linux Tips

Hi, this is Sandra Henry-Stocker, author of
the “Unix as a Second Language” blog on NetworkWorld.
In this Linux tip, we’re going to look at how you can move a running task into the background
and what that means. Let’s say you start a process that you don’t
want to stop, but you want to do something else while you’re waiting for it to finish.
You could always open a second terminal window, but there’s another option. You could move
the running process into a background and then run other commands. To do this, you would
first type ^z (hold control key and press z). That suspends the process. Then type bg
to put the process in the background. That leaves you with the ability to run other commands.
If the command you are waiting for is going to be sending output to you screen, that output
might be mixed into the output from commands you are running in the foreground. If that’s
not going to work for you, then you probably should open a second terminal window.
When you run a process in the background, it will have two numbers associated with it
– the process ID and the job number. Use the jobs command to list your backgrounded
processes. You can use a command like fg %1 to bring
a background process back to the foreground. The 1 corresponds to the number listed above
in the jobs queue. You can also run a process in the background
from the start by adding an & to the end of the line like this:
That’s your Linux tip for backgrounding a process. If you have questions or would
like to suggest a topic, please add a comment below. And don’t forget to subscribe to
the IDG Tech(talk) channel on YouTube. If you liked this video, please hit the like
and share buttons. For more Linux tips, be sure to follow us on Facebook, YouTube and

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *