![]() |
| | #1 |
| Registered User Join Date: May 2007 Location: Berkeley, CA
Posts: 140
| Why do I need & after xclock to get it to display over ssh? connected to the internet via dialup modem. I access X on Linux Machine from my Laptop at work via SSH. Now when invoke xclock over ssh, I have to type clock & in order to get the graphical clock to appear on my laptop. How I have to type & after xclock? I thought that once xclock was placed in the background, the shell would stop the xclock job when it tried to read from the standard input. However it doesn't. |
| Overworked_PhD is offline | |
| | #2 |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| Edit: Misunderstood the question. Any[1] "X" application started without a "&" at the end will run connected to the current task. Essentially what happens is: Code: fork();
if (!pid) { // child process
exec(applicaton);
}
else
{
if (!background) // Did it have a "&" at the end, if not do this:
wait(pid);
}
[1] Of course, it's entirely possible for the application to actually disconnect itself from the shell that started it - this is what daemon applications do. -- Mats
__________________ Compilers can produce warnings - make the compiler programmers happy: Use them! Please don't PM me for help - and no, I don't do help over instant messengers. Last edited by matsp; 03-01-2008 at 03:53 AM. |
| matsp is offline | |
| | #3 |
| Registered User Join Date: May 2007 Location: Berkeley, CA
Posts: 140
| Here is what I don't understand. When I'm connected to a remote desktop running Linux over ssh and try to execute xclock locally via the laptop, I get the following [cdalten@localhost~]$ xclock Error: Can't open display: How come the shell wouldn't just do [cdalten@localhost~]$ xclock And then display xclock? |
| Overworked_PhD is offline | |
| | #4 |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| You need to define the display as "machine:0" where machine is your machines name. (Or you could perhaps use "localhost:0" - but that won't work if you are using ssh to connect to another machine, as that would use the display on the machine you are connecting to. Actually, your machine names itself "localhost", which means that you haven't set a hostname. You could use the IP-address of the machine, but it would probably be better to set up the hostname. How you do that depends a bit on the distro you are using, but generally there is a GUI tool for configuring the system settings, where one of the settings is what the machine is called. -- Mats
__________________ Compilers can produce warnings - make the compiler programmers happy: Use them! Please don't PM me for help - and no, I don't do help over instant messengers. |
| matsp is offline | |
| | #5 |
| Registered User Join Date: May 2007 Location: Berkeley, CA
Posts: 140
| Then why would something like xclock & work? Why does the'&' make a difference in this case? |
| Overworked_PhD is offline | |
| | #6 |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| Shouldn't make any difference at all. -- Mats
__________________ Compilers can produce warnings - make the compiler programmers happy: Use them! Please don't PM me for help - and no, I don't do help over instant messengers. |
| matsp is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| display character size...(quite urgent..) | karthi | C Programming | 10 | 07-11-2007 09:42 PM |
| new problem with class | jrb47 | C++ Programming | 0 | 12-01-2006 08:39 AM |
| Help needed Please | jereland | C Programming | 9 | 03-18-2004 05:30 AM |
| Tab Controls - API | -KEN- | Windows Programming | 7 | 06-02-2002 09:44 AM |
| Speeding Up Display Time in CEditView :: MFC | kuphryn | Windows Programming | 0 | 04-22-2002 07:24 PM |