Skip to content

Sunday, December 20th, 2009

New Linux User

HOWTO: Use Job Control – Putting Processes in the Background

May 11, 2006 by Jon  
Filed under How To

Putting a process or application in the background means that the process essentially detaches itself from the consol, but keeps executing. This frees up the console to do other things.

You can either put a process into the background immediately upon launch, or you can stop a process already running in the foreground and resume it in the background.

To start a process in the background

nano &
[1] 7594

The & sign tells Linux to run nano in the background and reports the job id [1] and the Process ID (PID) [7594].

If I want to get at nano to use it, I can type fg or fg 1.

If I was already running nano and decided later that I wanted to push it to the background, I can use Control-Z to stop nano and then the bg command to resume it in the background.

CTRL-Z
[1]+ Stopped nano
bg

  • StumbleUpon
  • Digg
  • Facebook
  • Mixx
  • Google
  • TwitThis
  • Reddit
  • Yahoo! Buzz
  • Slashdot
  • E-mail this story to a friend!

Comments

3 Responses to “HOWTO: Use Job Control – Putting Processes in the Background”
  1. Eric Coleman says:

    Why not use screen?

    screen
    type do whatever
    ctrl + alt + d (detach)

    then you can resume using screen -r

  2. Jon says:

    That’s great if I know ahead of time that I’m going to want to bail out of what I’m doing. If I don’t, then I won’t have run screen, no?

    I haven’t run across screen yet so I may have its functionality wrong.

    My method always works regardless of whether I thought ahead or not :)

  3. Eric Coleman says:

    Setup your shell to autostart screen then… you always have a session available then ;)

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!


About Us | Advertise with us | Blog for EveryJoe | Privacy Policy | Terms of Use
Get This Theme | Sitemap


All content is Copyright © 2005-2009 b5media. All rights reserved.