linux scp远程上传下载文件文件夹

it2024-08-01  38

scp是secure copy的简写,用于在Linux下进行远程拷贝文件的命令。

1、从服务器下载文件

# scp username@serverip:/path/filename /tmp/local_destination

eg. 

# scp root@192.168.0.1:/root/text.txt /tmp/local_destination

 

2、上传本地文件到服务器

# scp /path/local_filename username@serverip:/path

eg. 

# scp /var/www/test.php  root@192.168.0.1:/var/www/

把本机/var/www/目录下的test.php文件上传到192.168.0.101这台服务器上的/var/www/目录中

 

3、从服务器下载整个目录

# scp -r username@serverip:remote_dir/ /tmp/local_dir

4、上传目录到服务器

# scp -r /tmp/local_dir username@serverip:remote_dir

 

最新回复(0)