Reroute stdout over ssh

I would love to run

something > file

on a remote system via ssh, yet if I run

ssh host something > file

the redirection is implemented in your area as ssh etc > file

I've attempted it with ' or '' or dd or with a pipe | rather, yet I can not get it to function. Just how can this be done?

0
2019-05-04 12:44:11
Source Share
Answers: 2

Even less complex, as opposed to :

ssh host something > file

do :

ssh host "something > file"
0
2019-05-08 03:40:51
Source

Try :

ssh host 'something > file'

Below's a contrived demo of a means to take care of redirection, pipelines and also prices estimate :

ssh host date -d yesterday \| awk "'{print $1}'" \> 'file" "with\ spaces.out'

The pipe and also redirection are run away as opposed to being had in a total external set of quotes, lowering the demand to run away one degree of quotes. The solitary quotes for the AWK command are shielded by the double quotes that border them. The filename can be shielded similarly, yet below I demonstrate how the solitary quotes shield the double quotes and also the retreat.

0
2019-05-07 23:31:23
Source