So you need to copy a file you have on a remote server locally, or send a local file to a remote server? Fortunatally, it’s pretty easy with scp. Here’s an example to copy a remote server to the local machine.
scp -P 65124 remoteuser@remotehost:/var/lib/path/to/file.txt /var/lib/path/to/…which will connect to “remotehost” on port 65124 as “remoteuser” and copy the /var/lib/path/to/file.txt on “remotehost” to the local /var/lib/path/to/ directory.
Need to copy a local file to a remote host? Just switch the parameters up!
scp -P 65124 /var/lib/path/to/file.txt remoteuser@remotehost:/var/lib/path/to/