20

Situation: I have 2 computers: Pc_A and Pc_B. I am also using a SSH connection that goes from A to B.

My problem: I have a folder saved on the desktop of Pc_A and I need to copy it to the desktop of Pc_B via terminal. The thing is that once I open the terminal on Pc_A and I connect to Pc_B I'm no longer capable of transferring data from one computer to another...

Question: does anyone have the idea of what should be done in such case?

2 Answers2

36

You could use scp:

When you're on PCB:

scp -r your_user_name@ip_address_of_PCA:/path/to/remote/directory /path/to/local/directory
17

On PC A, instead of connecting to PC B by ssh, just run

rsync /path/to/local/file username@PCB:/path/to/remote/destination

You could also use scp instead of rsync, with similar formatting for the rest of the line, but I prefer rsync, since it's more powerful, and (I think) verifies after copying. See man rsync for more details. N.B. that the remote computer must have rsync installed too (see comments by neon_overload), otherwise scp would be preferred.

If installed on both computers, rsync will take advantage of the processing power of both. For example, it can compress files before transfer, by using the -z flag.

Sparhawk
  • 6,969