Article 580VQ redirect command output across ssh to a file

redirect command output across ssh to a file

by
taylorkh
from LinuxQuestions.org on (#580VQ)
I think this is rather simple and perhaps I have simply overlooked something. I can access a remote computer using ssh (my key is installed, no password req'd) I can read from a file on that server. Code:[ken@taylor20 ~]$ ssh 10.42.0.1 grep "VA" /etc/protonvpn/allservers
US-VA#1
US-VA#2
US-VA#3
US-VA#4So far so good. I need to write my results to another file on the remote machine. Here is what I would like to do but it does not workQuote:
[ken@taylor20 ~]$ ssh 10.42.0.1 grep "VA" /etc/protonvpn/allservers > /etc/protonvpn/selectedservers
bash: /etc/protonvpn/selectedservers: No such file or directory
I could write the results to a local file and then scp the file to the remote computer. However, I am wondering if I can do this in a single step.

Thanks,

Kenlatest?d=yIl2AUoC8zA latest?i=7CqjrgpTQho:_oFELt5IZEM:F7zBnMy latest?i=7CqjrgpTQho:_oFELt5IZEM:V_sGLiP latest?d=qj6IDK7rITs latest?i=7CqjrgpTQho:_oFELt5IZEM:gIN9vFw7CqjrgpTQho
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments