How to copy logs over SSH?

Is there an easy way to get a log file, or copy all the text in a log file, over SSH?

I only know how to open it in nano and then I can copy but only the page I am looking at.

Maybe sftp, to just transfer the file.

Works roughly the same as ssh and use ssh for connection:

sftp user@servername
get remotefilename

To get the file
You can use ls and cd like you normally can with ssh.

1 Like

The tool you are looking for is ‘scp’ or ‘magic-wormhole’. ‘magic-wormhole’ is even better IMO (much easier to use), but I think its only available on Unix systems if that is a problem for you

2 Likes

Ok, guess I have to figure out SCP.

I think Cyberduck also has this functionality

Please use rsync instead of scp if you not have used it in the past.
Reason: Deprecating scp [LWN.net]

How to keep files in sync with rsync:

1 Like

With rsync , you can transfer files and directories over SSH from and to remote servers.

Enable/start rsync and ssh to your local machine and remote server.
Connect to the remote server over ssh

To transfer grin data from a remote server to a local machine
rsync -a user@xx.xx.x.x:/remotehome/user/.grin /home/localhome/

To transfer grin data to the directory on a remote server
rsync -a /localhome/user/.grin user@xx.xx.x.x:/remotehome/user

You can also anonymize your ssh traffic with tor.

1 Like