SCP Command – Moving large files from one linux server to your new linux server

Ok, so you like to move your 3 gig backup from your old server to your new server, but the the good old wget command is not doing the trick?

There is an easy way around with the scp command

Log into your old server where you want to move that big tar file from and

scp yourlarge3gigfile.tgz
(enter the root pass for the new server and let it copy the file over)

If you run SSH on a different port (that is, not the default port 22) and you need to scp then it can be done by:

scp -P <port> yourlarge3gigfile.tgz

For example, if your ssh/scp is on port 2000 then:

scp -P 2000 yourlarge3gigfile.tgz

the above command will connect to scp/ssh port 2000 and copy the file to the remote user’s home directory in the remote server.

If you use SSH key based authentication then when you scp, scp will not ask for user’s password. It will copy your file to the remote server using your ssh private key. Example,

scp -i your_private_key yourlarge3gigfile.tgz

the above command will use your ssh private key and copy the file (file.txt) in the remote_user’s home directory.

Spread the love

Posted by News Monkey