Write file from remote server to local directory?

2

1

I want to do some grep-magic to a logfile on a remote server and write the result to a local file on my computer.

Is there an easier way than my 3 step solution:

  1. do grep-magic and write file on remote server
  2. copy from remote to local with scp
  3. delete the file on remote

Johannes Zink

Posted 2016-04-01T12:02:54.463

Reputation: 123

Answers

3

Just execute the command in the remote server through ssh and store the output locally:

ssh myuser@thatserver 'grep "aa"' > ~/myoutput.res

fedorqui

Posted 2016-04-01T12:02:54.463

Reputation: 1 517