SCP命名使用

SCP uses Secure Shell (SSH) to transfer data between client and remote server, it’s fast and secure. In this article, we will show you two common SCP copying examples :
Copying data from your computer to remote server.
Copying data from remote server to your computer.
1. Copying data to Remote Server
Example 1.1 – Copying a file.
scp SourceFile user@server:directory/TargetFile
Copy a file “gae.log” from local computer to remote server(thejtechs.com), ‘/home/thejtechs/‘ folder, via username “thejtechs“.
$ scp gae.log thejtechs@thejtechs.com:/home/thejtechs/
Password:
stdin: is not a tty
gae.log     100% 4193     4.1KB/s   00:00
Example 1.2 – Copying a folder, and all its content.
scp -r SourceFolder user@server:directory/TargetFolder
Copy a folder “tutorials” from local computer to server(thejtechs.com), ‘/home/thejtechs/‘ folder, via username “thejtechs“.
$ scp -r tutorials thejtechs@thejtechs.com:/home/thejtechs/
Password:
stdin: is not a tty
aweber.txt       100% 2895     2.8KB/s   00:01
codetraining.txt 100%  330     0.3KB/s   00:00
contact.txt      100%  146     0.1KB/s   00:00
eclipse.txt      100% 5719     5.6KB/s   00:00
2. Copying data from Remote Server
Example 2.1 – Copying a file.
scp user@server:directory/SourceFile TargetFile

Copy a file “/home/thejtechs/modsec_audit.log” from remote server(thejtechs.com), to local, current folder (“.“), via username “root“.
$ scp root@thejtechs.com:/home/thejtechs/modsec_audit.log .
Password:
stdin: is not a tty
modsec_audit.log  100%  244KB 122.1KB/s   00:02
Example 2.2 – Copying a folder, and all its content.
scp -r user@server:directory/SourceFolder TargetFolder
Copy a folder “/home/thejtechs/mail” from remote server(thejtechs.com), to local, current folder (“.“), via username “thejtechs“.
Yongs-MacBook-Air:~ thejtechs$ scp -r thejtechs@thejtechs.com:/home/thejtechs/mail .
Password:
stdin: is not a tty
courierimapuiddb      100%   15     0.0KB/s   00:00
courierpop3dsizelist  100%   88     0.1KB/s   00:01
courierimapacl        100%   43     0.0KB/s   00:00
maildirsize           100%  348     0.3KB/s   00:00

SSH Port
If your server uses a SSH port other than the default of 22, use -P portnumber option.
scp -P 2222 user@host:directory/SourceFile TargetFile
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值