LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Run command on a different terminal (https://www.linuxquestions.org/questions/linux-general-1/run-command-on-a-different-terminal-450960/)

jantman 06-02-2006 12:48 PM

Run command on a different terminal
 
I consider myself a fairly advanced Linux user but have never come by this before. I want to run a command not only as a different user, but redirected to their terminal/session.

Example:

Targer computer has a console X Windows session open running KDE. I have KTorrent installed on the computer, which is a KDE-based BitTorrent GUI. It will (obviously) only run in an X-Windows session.

I login as the same user (or su to root) from a remote terminal (SSH2 session).

Now, I want to run ktorrent in the console session, so that it will be there when I get home.

Is there any way to do this? I understand about running commands as different users using su -c but I have no experience with running commands as a different session, or redirecting to a different terminal.

Thanks.

reddazz 06-02-2006 01:34 PM

You need X to be running if you want to use ktorrent. What I tend to do if I need to run a gui app from a remote machine using ssh is: CTRL-ALT-F1, login into the command line, do "xinit -- :1" to start a new x session, login to the remote machine (ssh -X -Y machine) and run something like startkde to start my DE or WM of choice.

LinuxDave 06-02-2006 01:51 PM

This is simple to do.

If you have a target X session up, you can start application from another terminal that show up in your X session by simply setting the DISPLAY variable.

For example, if your X session is DISPLAY=:0

Then, in your ssh text-only window type the following:

export DISPLAY=:0
ktorrent&

The KTorrent window should be waiting for you when you get to your X session.

Note that you must already be logged in and have an active X session.

LinuxDave

jantman 06-07-2006 01:32 PM

Thanks, Dave. I'll try it later. That's exactly what I was looking for.


All times are GMT -5. The time now is 01:00 PM.