scp: Syntax und Beispiele

Wenn SSH auf Ziel- und Quellmaschine installiert ist, können über scp 1) Dateien über das Terminal verschoben werden. Die Syntax hierzu wird an einigen Beispielen erklärt:

Copy the file »foobar.txt« from a remote host directory to the local host:

$ scp your_username@remotehost.edu:/some/remote/directory/foobar.txt /some/local/directory

Copy the file »foo bar.txt« from a remote host directory to the local host. Please note the space in the filename:

$ scp your_username@remotehost.edu:'/some/remote/directory/foo\ bar.txt' /some/local/directory

Copy the file »foobar.txt« from the local host to a remote host:

$ scp /path/to/local/directory/foobar.txt your_username@remotehost.edu:/some/remote/directory

Copy the directory »foo« from the local host to a remote host's directory »bar«:

$ scp -r foo your_username@remotehost.edu:/some/remote/directory/bar

Copy the file »foobar.txt« from remote host »rh1.edu« to remote host »rh2.edu«:

$ scp your_username@rh1.edu:/some/remote/directory/foobar.txt your_username@rh2.edu:/some/remote/directory/

Copy the files »foo.txt« and »bar.txt« from the local host to your home directory on the remote host:

$ scp foo.txt bar.txt your_username@remotehost.edu:~  

Copy multiple files from the remote host to your current directory on the local host:

$ scp your_username@remotehost.edu:/some/remote/directory/\{a,b,c\} .  

$ scp your_username@remotehost.edu:~/\{foo.txt,bar.txt\} .  

scp Performance

Der Default Encryption Algorythmus bei SSH ist Triple-DES. Bei Verwendung der Blowfish Encryption (-c blowfish) kann die Performance uU gesteigert werden. Beide Stationen müssen dazu die Blowfish Encryption unterstützen.

Copy the file »foobar.txt« from localhost to remote users home directory by using the blowfish cypher:

$ scp -c blowfish foobar.txt your_username@remotehost.edu:~

Ebenfalls kann es die Performance positiv beeinflussen, wenn man die Kompression (- C) eingeschaltet. Diese Option kann den Durchsatz bei langsamen Verbindungen (WAN etc) erheblich steigern, bei schnellen Netzwerken (LAN etc) jedoch wird sich der Durchsatz nicht signifikant erhöhen.

Copy the file »foobar.txt« from localhost to remote users home directory by using the blowfish cypher and compressed data transfer:

$ scp -c blowfish -C foobar.txt your_username@remotehost.edu:~

pronto 2010/03/29 20:04

tux/scp.txt (52929 views) · Zuletzt geändert: 2011/07/28 11:21 von wikisysop
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0