pseudo terminals

Gordon Messmer yinyang at
Thu Sep 10 20:28:41 UTC 2009

On 09/10/2009 08:12 AM, devi wrote:
> Hi,
> 	I think , I have not explained it correctly, in the first mail.  I mean
> that
> "echo "service httpd status">  /dev/pts/2", is executed in first
> terminal(/dev/pts/1),  and the output is redirected to the /dev/pts/2.

That is correct.  The "echo" command will execute in the terminal into 
which you entered the command, and the output ("service httpd status") 
will be redirected to /dev/pts/2.

> Here /dev/pts/2 is the terminal of another machine to which we are
> connnected and is a virtual machine.
> But the output directed here is a command, so what happens is that,
> the output of the first terminal, is actually executed as a command in
> the /dev/pts/2 terminal, because the output is redirected directly to
> the terminal.

That is not correct, and also contradicts your previous statements.  
Please test this again.  Redirecting output to a different tty will not 
cause a command to be executed there.

> And I know the pty of the first terminal, I got it by command "tty".
> Now, my requirement is that, after the command "service httpd status" is
> executed on the /dev/pts/2.  I want to redirect or get the output on the
> first terminal(/dev/pts/1).

Why do you need to execute a command in /dev/pts/2 without entering the 
command there?

More information about the users mailing list