Linux Commands(I) scp

本文深入探讨了Linux scp命令的使用方法,包括如何在本地和远程主机间复制文件和目录,提供了具体示例和常见命令用法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Linux Commands(I) scp

1. scp is Secure Copy.

Copy the file from a remote host to the local host
>scp luohua@remote.server.com:/home/luohua/server.txt /home/luohua/tmp/server.txt

Copy the directory "client" from the local host to a remote host's directory "server"
>scp -r client luohua@remote.server.com:/home/luohua/server

Some other examples
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/

Copying 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\} .

2. Test to run them in shell script
>vi data_import.sh
#!/bin/sh

echo "step1 start.................."
scp luohua@remote.server.com:~/server.txt ./t1.txt
echo "step1 end...................."

echo "step2 start.................."
wget http://www.baidu.com
echo "step2 end...................."

references:
http://www.hypexr.org/linux_scp_help.php
http://www.computerhope.com/unix/wget.htm
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值