theshell.ch/site/pages/cmd/interm/scp.html

47 lines
1.6 KiB
HTML

---
layout: page
category-page: intermediate
category-title: Intermediate commands
tags: ssh copy file secure
author: Announ Marwan
title: scp
previous-page: pages/cmd/interm/ps.html
next-page: pages/cmd/interm/shasum.html
---
The <code>scp</code> command name stands for <i>Secure CoPy</i>.<br>
As the name suggests it's similar to the <code>cp</code> command,
with the main difference being that while <code>cp</code> is used to move files
in a local machine, <code>scp</code> will also operate on the remote systems.<br>
The syntax is similar to the one of the <code>cp</code> command.
<pre>
scp ~/Documents/list.txt protocol://user@myhost.com:/home/user/Documents/list.txt
</pre>
Keep in mind that <code>protocol://user@myhost.com</code> should be changed accordingly to
your use case and may require authentication on the remote server.<br>
It's also possible to download files in a similar way.
<pre>
scp protocol://user@myhost.com:/home/user/Documents/list.txt ~/Downloads/list.txt
</pre>
And it can also operate on the remote host only:
<pre>
scp protocol://user@myhost.com:/home/user/Documents/list.txt protocol://user@myhost.com:/home/user/Download/shopping.txt
</pre>
<h3>Flags</h3>
<ul>
<li>-1 to use scp with protocol 1 </li>
<li>-2 to use scp with protocol 2 </li>
<li>-3 to copy between 2 remote passing through local(like example above) </li>
<li>-4 to use scp with IPv4 addresses </li>
<li>-6 o use scp with Ipv6 addresses </li>
<li>-C to enable compression of the encrypted connection </li>
<li>-c to encrypt data transfer (<i>C</i> and <i>c</i> are <u>not</u> the same flag)</li>
</ul>