Using the scp Command in CentOS

Repost from: http://www.centos.org/docs/5/html/5.1/Deployment_Guide/s2-openssh-using-scp.html


The scp command can be used to transfer files between machines over a secure, encrypted connection. It is similar to rcp.

The general syntax to transfer a local file to a remote system is as follows:

scp <localfile>username@tohostname:<remotefile>

The <localfile> specifies the source including path to the file, such as /var/log/maillog. The<remotefile> specifies the destination, which can be a new filename such as /tmp/hostname-maillog. For the remote system, if you do not have a preceding /, the path will be relative to the home directory of username, typically /home/username/.

To transfer the local file shadowman to the home directory of your account on penguin.example.net, type the following at a shell prompt (replace username with your username):

scp shadowman username@penguin.example.net:shadowman

This will transfer the local file shadowman to /home/username/shadowman on penguin.example.net. Alternately, you can leave off the final shadowman in the scp command.

The general syntax to transfer a remote file to the local system is as follows:

scp username@tohostname:<remotefile><newlocalfile>

The <remotefile> specifies the source including path, and <newlocalfile> specifies the destination including path.

Multiple files can be specified as the source files. For example, to transfer the contents of the directorydownloads/ to an existing directory called uploads/ on the remote machine penguin.example.net, type the following at a shell prompt:

scp downloads/* username@penguin.example.net:uploads/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值