detach a process

Shawn Tayler stayler
Mon May 17 11:46:18 PDT 2004



Thanks Guys,

That & thing was what I was looking for.  I've been using screen for some things and it's probably the most like detach that I've found but trhe & is definitely more convenient under some circumstances.  I suppoose if I got off my lazy &$$ I could learn C and make one myself.

Thanks again!

Shawn



On Sun, 6 Apr 2003 07:18:40 -0500 "David A. Bandel" <david at pananix.com> professed:


> In a BASH shell, you can take a process running in the foreground and
> put it into the background via the following:
> <Ctrl>+Z (this pauses execution and give you a command line)
> bg (this tell the process to go into the background)
> 
> you can do the same thing as above when you start the command by putting
> '&' at the end of the command line (./myprogram &)
> 
> any command you shoved into the background, you can see using the
> command:
> jobs
> you can bring it to the foreground using:
> fg
> 
> if you have a number of jobs, you can reference to them by number.  You
> can foreground or kill them (using the fg or kill commands).
> 
> Problems:
> some commands will exit when you background them and exit the shell. 
> These are usually programs that expect or need a controlling terminal. 
> Also, your program may hang if it's running in the background and
> requires input because you now cannot provide it input (nor can it
> provide you output).
> 
> If you must start a program you don't want to exit when you logout, try
> running it with `nohup` (nohup ./myprogram &).  Don't forget the '&' at
> the end.
> 
> The above only works with shells so programmed.  I know it works with
> BASH, others may or may not work as above.
> 
> HTH,
> 
> David A. Bandel
> -- 
> Focus on the dream, not the competition.
> 		Nemesis Racing Team motto
> 


More information about the Linux-users mailing list