linux命令scp使用例子
时间: 2024-02-04 11:09:57 浏览: 72
linux中scp命令和scp命令用法大全
以下是使用Linux命令scp进行文件远程拷贝的例子:
1. 从本地复制文件到远程服务器:
```shell
scp /path/to/local/file username@remote:/path/to/destination
```
示例:
```shell
scp /home/user/file.txt user@192.168.0.1:/home/destination/
```
2. 从远程服务器复制文件到本地:
```shell
scp username@remote:/path/to/remote/file /path/to/destination
```
示例:
```shell
scp user@192.168.0.1:/home/user/file.txt /home/destination/
```
3. 从远程服务器复制整个目录到本地:
```shell
scp -r username@remote:/path/to/remote/directory /path/to/destination
```
示例:
```shell
scp -r user@192.168.0.1:/home/user/directory /home/destination/
```
4. 从本地复制整个目录到远程服务器:
```shell
scp -r /path/to/local/directory username@remote:/path/to/destination
```
示例:
```shell
scp -r /home/user/directory user@192.168.0.1:/home/destination/
```
阅读全文