Take the 2-minute tour ×

I have some file tools on a mint machine that I would rather not install on my mac laptop. Mainly because of the vastness of apt-get and the low risk of installation failure. Anyway, every so often I have a file that I want to process in place using some remote tool. Both machines can ssh right in to each other so I was figuring there must be some script or tool out there that would allow me to type out something like remote [file] [tool & args] to send my file to the other machine, get it processed, then get it back.

share|improve this question

4 Answers 4

up vote 3 down vote accepted

If the tool is a simple filter then you can just use it normally, but over ssh.

ssh user@host somefilter < infile > outfile

If it expects a filename but doesn't need to seek around in it or the output file then you can (ab)use bash for this.

ssh user@host bash -c "sometool <(/dev/stdin) -o >(/dev/stdout)" < infile > outfile

Otherwise you will have to transfer the file to or from the other system.

share|improve this answer

The UNIX concept is do one thing and do it quietly. You can then build your own tools based on those simple processes.

You just need to write a script which scp's the file to your machine, runs the ssh command to modify it and then pulls it back. Three lines, here's a very simple template,

scp oldfile myuser@myother.machine:/some/directory/file.to.process
ssh myuser@myother.machine "/usr/bin/something /some/directory/file.to.process"
scp myuser@myother.machine:/some/directory/file.which.is.processed newfile

Add parameters and put some error checking in and you're good to go.

Or, as the other answer shows, you can route stdin/stdout to the other machine so for filters, it's even simpler.

share|improve this answer

Well, you could set up X11 forwarding through ssh from the machine the file-to-process is located in. This page is a good tutorial on how to do this. It basically lets you run the program from the remote server on your computer (using your computer's resources).

share|improve this answer
No, it uses the other computer's resources, and your X server. Also, the X server is not installed by default on OS X. –  Ignacio Vazquez-Abrams Jul 14 '11 at 22:21

You can also try mounting the other system as a directory. Then you can access it normally as if it was on your mint machine. sshfs is one way to do this.

mac$ ssh user@mint
mint$ mkdir ~/mac
mint$ sshfs user@mac:/path ~/mac
mint$ tool ~/mac/file
share|improve this answer

Your Answer


