terminal: running a command located on another machine?

Soldato
Joined
3 Dec 2002
Posts
4,034
Location
Groovin' @ the disco
Hi

Can someone the syntax to run command located on my machine on a remote machine and vice visa... running a syntax on a local machine but the command is located on a remote machine?

Assuming this is possible without copying the command locally first.

Thanks in Advance...
 
If think I sorted it..

to run a local command and send it to remote machine.
Code:
ssh command > remoteuser@remotesocket

to run a command stored on a remote machine
Code:
ssh remoteuser@remotesocket:command > localuser@localmachine

I've not tested it yet, but pretty sure at least the top one will work.. will try it when I'm back at work on Wednesday...
 
Hi

Thanks for the help, but that syntax would me that the command would have to be on the machine that I'm remote on to.
 
What I'm trying to do is

A) exec a command stored only locally on the machine and not remote machine, but to affect the remote machine.

B) exec a command stored on another machine but not the stored on the machine I'm working from, but to affect the local machine.

The example you give will work if the command is on the remote machine and will affect the remote machine.

Yes I know it's far simpler to use the scp command and copy the commands back and forth, but I'm working with a rather large number of machines, and the commands only need to be exec once on the machine.

This is why I'm pipping the command to pass the command across.
 
Back
Top Bottom