5

In Linux, what is the difference between a foreground job and a background job?

Yasser Souri
  • 1,967
  • 2
  • 19
  • 26
  • This is a general reference question. Consult [an encyclopedia](http://en.wikipedia.org/wiki/Job_control_%28Unix%29) or a book. – Gilles 'SO- stop being evil' Jul 04 '11 at 16:28
  • I've read that and there is not info there on this topic. – Yasser Souri Jul 04 '11 at 17:20
  • Moderator's have decide to close this because _It's difficult to tell what is being asked here._! This really surprises me, because my question is clearly indicated. – Yasser Souri Jul 04 '11 at 17:22
  • This question was closed (at least in my case) because there is a good answer already in Wikipedia, so you don't need a human being to compose an answer tailored for you. If you don't understand the article or want more information, feel free to ask a more focused question, summarizing what you do understand and indicating what specific point you have a problem with. – Gilles 'SO- stop being evil' Jul 04 '11 at 17:35
  • 2
    So anything that's explained on Wikipedia is off topic for Stackoverflow? That [doesn't seem consistent](http://stackoverflow.com/questions/246930/is-there-any-difference-between-a-guid-and-a-uuid). This is a good question; I've been asked this several times by fellow students and coworkers. I don't see why Stackoverflow shouldn't be used to provide a more clear, concise answer. – aaronstacy Jul 05 '11 at 14:16

1 Answers1

4

In a foreground job, all of your input is directed to the process's stdin (including the SIGINT that is generated when you press CTRL-C, and that's why you can still kill the process if it's in the foreground).

In a background job your input is directed to the shell process instead, and that is why you see the shell prompt and you can execute commands.

aaronstacy
  • 6,189
  • 13
  • 59
  • 72