When I use this command in xterm, some_command &, a new window opens with a program corresponding to the command, and it seems to be altogether separate window from the xterm window from which it was spawned. However, when I do this command in xterm, some_command, without the "&" after it, then a window opens likewise, but it seems to be connected to the original xterm window. I can kill the spawned window with Ctl+c in the xterm window.

Where can I find a discussion of this connection between these windows? I am interested in knowing, among other things, whether this connection servers any purpose other than allowing me to kill the second process? In other words, can I use the connection for any other use? I would appreciate any pointers someone can provide to a link or other discussion concerning this matter. Thanks.

The & means run the command in the background. Normally, without the &, a program open in the foreground of the shell that called it, preventing another program from being run from that shell. With the &, the program opens in the background, allowing the shell to do other things while the program runs.

This is of varying levels of utility, for example X programs don't generally require the use of the terminal, so doing other things with the terminal might be nice. It's also useful for processes that run a server, and don't necessarily need interaction from a user after starting. On the other hand, using & with a CLI program that requires user interaction would probably make things more difficult.

You may notice that when using &, the shell prints a number, this is the process ID of the backgrounded command, which can be passed to the 'kill' command to kill the process, much like Ctrl+C when the process is running in the foreground. You can also issue the 'jobs' command to list all the programs you have backgrounded or suspended.

> "You may notice that when using &, the shell prints a number, this is the process ID of the backgrounded command, which can be passed to the 'kill' command to kill the process, much like Ctrl+C when the process is running in the foreground. "

that number is handy in case of problems with the running process because I have seen a number of times when it was hard to identify easily exactly which process was associated with any given number, and that made it somewhat of a guess in 'top'. Thanks for your reply and take care.

Once you know a bit about the background come back and ask again. You'll probably be more accurate on your question and we will be able to provide you with a better answer as well _________________Gentoo Handbook | My website

The shell can be thought of a program you can use to launch other programs. Unless you tell it otherwise, it will assume that you want to run a program, interact with it, and control won't return to the shell until that program ends. This is a logical choice for most terminal programs, such as nano.

As you already know, you can use & to run in the background, which is more appropriate for X programs. If you forgot the &, you can also press ctrl+Z to stop the program and then bg to tell the shell to resume running, but now in the background.

Since it was the shell the process that launched your application, if you close the terminal, then you will also kill its child processes, and that means your application.

It is possible to prevent this behavior by issuing the "disown" command, that way you application is not considered a child of the terminal and you can close the latter without fear of also closing the former.