Copying files using SSH.

Marc Wag­ner

Octo­ber 2, 2020

1 min read|

As an Inter­net agen­cy, we also hand­le relo­ca­ti­ons and migra­ti­ons of web­sites, por­tals and appli­ca­ti­ons. In some cases, this can alre­a­dy mean seve­ral GB of data.

The most effec­ti­ve way to copy data from one sys­tem to ano­ther is via SSH. Of cour­se, the pre­re­qui­si­te for this is that both hos­ting packa­ges offer SSH access.

One way to copy files bet­ween two ser­vers is with SCP.

To copy the data from your local server to a remote server #

Log in via SSH to the ser­ver from which you want to copy the data.

Then enter the fol­lo­wing line in the con­so­le:

scp -r /pfad/zum/lokalen/verzeichnis [email protected]:/pfad/zum/remote/verzeichnis

After ente­ring your pass­word, the copy­ing pro­cess should alre­a­dy start.

To copy the data from a remote server to your local server #

Log in via SSH to the ser­ver whe­re you want to insert the data.

Then enter the fol­lo­wing line in the con­so­le:

scp -r [email protected]:/pfad/zum/remote/verzeichnis /pfad/zum/lokalen/verzeichnis

After ente­ring your pass­word, the copy­ing pro­cess will begin.

Run SCP in the background #

If you don’t want to watch the pro­cess per­ma­nent­ly, you can move it to the back­ground.

Press CTRL+Z to pau­se copy­ing. After­wards you can use bg to restart the pro­cess in the back­ground wit­hout having to stay the­re. With exit you can clo­se the ter­mi­nal.

  1. CTRL+Z to pau­se the pro­cess
  2. bg in the ter­mi­nal to run the pro­cess in the back­ground.
  3. exit to clo­se the ter­mi­nal.

If SCP is not the right thing for you, you can look at copy­ing files using rsync as an alter­na­ti­ve.

Was this artic­le hel­pful? How do you copy the data when you make a move? Wri­te us a com­ment. We app­re­cia­te your feed­back.

88e86fcb816eff22bc917094df2862d8dd5c0e978b333e6dd5f36f808990c261 96

Arti­kel von:

Marc Wag­ner

Hi Marc here. I’m the foun­der of Forge12 Inter­ac­ti­ve and have been pas­sio­na­te about buil­ding web­sites, online stores, appli­ca­ti­ons and SaaS solu­ti­ons for busi­nesses for over 20 years. Befo­re foun­ding the com­pa­ny, I alre­a­dy work­ed in publicly lis­ted com­pa­nies and acqui­red all kinds of know­ledge. Now I want to pass this know­ledge on to my cus­to­mers.

Hast du eine Fra­ge? Hin­ter­lass bit­te einen Kom­men­tar