Q: Pipe output of c program on remote machine to local machine I am running a c program on an ec2 instance (ubuntu). I want to capture the output of that c program and save it to an excel file on my local machine.
I have already tried what is listed here How do I scp the (huge) output of a command directly to a remote machine? but when I try to connect to my local machine from my ec2 instance nothing happens. It just hangs until I inevitable ctrl + c
My local machine is a mac. I ran ifconfig to get my ip and whoami to see what account I should ssh to. It's not working. What is the proper syntax to pipe output from remote machine to my local machine?

A: Your local machine is probably behind a firewall (or at least network address translation), and not reachable from the outside. But you should be able to initiate the connection from your local computer, run the program, and capture the output that comes back. Something like this:
ssh -i whatever ecuser@ecaddress '/path/to/c-program' >outputfile

Replacing "ssh -i whatever ecuser@ecaddress" with your the ssh command you usually use, "/path/to/c-program" with the actual filesystem location of the program you want to run, and "outputfile" with the (local) filename you want to save the output as. If the program needs any command-line arguments, add them after the program path. If it needs input, type it in over the ssh connection, or use input redirection (note: redirections inside the quotes will happen on the ec2 instance, but redirections outside them will happen on the local computer).
