Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Mar 2000 12:43:32 -0800 (PST)
From:      Derrick Baumer <bduk@earthlink.net>
To:        suckworldcreator@hotmail.com
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: using & commands
Message-ID:  <200003302043.MAA00360@earthlink.net>
In-Reply-To: <20000330195324.59712.qmail@hotmail.com> (suckworldcreator@hotmail.com)

next in thread | previous in thread | raw e-mail | index | archive | help

> From: "Sarah Li" <suckworldcreator@hotmail.com>
> 
> To whom it may concern:
> 
> I am currently doing a project on Free BSD and I have a few
> questions. The first one is what is the & along with a command used
> for?

It runs the program in the background...

> and what does it mean by putting it into the background?

...which means it starts running, but it frees your terminal up to do
other things.  For example, if I want to send mail mail out, I would
type 'sendmail -q', then wait for 30 seconds or so while it did its
job, then it'd finish and I'd have my prompt back so I could continue
working.  (Run-on sentence from hell there, eh?)

Instead, I can type 'sendmail -q &' and it will immediately give my
control back to do other things while it runs in the background.

> also, how would you stop a background task that has gone beserk?

Then, if I suddenly decided I wanted to stop sendmail from finishing
its job, I would type 'fg'.  That will bring the program back to the
foreground so I could stop it.

If you have multiple jobs in the background, typing 'fg' will just
bring the last one up.  To bring a specific one up, you need to type
'fc -l', which will list all of the background processes you have
running.  The first column is the background job number.  If I wanted
to bring job 3 up, I would type 'fg 3'.

Hope that helped.

-- 
Derrick Baumer - Black Duck Software
        <bduk@earthlink.net>


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200003302043.MAA00360>