I used Xterm -e command to run six programs in the background in six X terminals in my shell script. When I used PS command, I can see 6 Xterm process running in the background but I can't see the programs. If I used Top command, I can see the programs. Is there a clean way to kill all the x terminals and the programs?

Here is the xterminal command in my script:

xterm -e "script -c \"program\" outputfile" &

Another problem is I try to capture the output of the program to a file, but for some reason I can only capture part of it. If I get rid of the & at the end, I can capture all the output but I can't get control back since the program is running as a server, which means it doesn't end unless I kill the server.


ps without arguments/options displays only processes connected to the current terminal. Anything you run in a new xterm will have that xterm's pseudotty as its controlling terminal.

You can usually get away with killing the xterms to kill the programs running in them.

| improve this answer | |
  • Thanks for the reply. I did close all the xterms. But top still shows those processing are running. – Anonymous Jan 31 '11 at 19:19

These three links may be of interest:

  1. pgrep and pkill - Solaris specific page
  2. This page on window process management on U&L
  3. The Process Chain at docstore
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy