如何在Windows上使用PSCP命令?

pscp command is an SCP protocol implementation where we can transfer and copy files and folders securely over a network with the SSH connection. In this tutorial, we will learn how to install and use pscp tool on Windows operating system.

pscp命令是SCP协议的实现,我们可以使用SSH连接在网络上安全地传输和复制文件和文件夹。 在本教程中,我们将学习如何在Windows操作系统上安装和使用pscp工具。

下载Pscp (Download Pscp)

pscp command can be downloaded from the following link. There are different installation types. pscp can be installed in standalone or with the putty installer package. I prefer Putty installation package where path environment configuration also done automatically.

可以从以下链接下载pscp命令。 有不同的安装类型。 pscp可以独立安装,也可以与腻子安装程序一起安装。 我更喜欢Putty安装软件包,其中路径环境配置也会自动完成。

https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

Download Pscp
Download Pscp
下载Pscp

As we can see there is 32 and 64 bit versions. I will use 64 bit because my Windows is 64 bit.

我们可以看到有32位和64位版本。 我将使用64位,因为我的Windows是64位。

安装Pscp (Install Pscp)

We will install the downloaded putty 64 bit msi package regular Windows Next->Next style like below.

我们将安装下载的普通腻子64位msi软件包,常规Windows Next-> Next样式如下。

Install Pscp
Install Pscp
安装Pscp

帮助和选项 (Help and Options)

If we need to list all available options and help information we can just issue pscp command to the command line or MSDOS like below.

如果我们需要列出所有可用的选项和帮助信息,我们可以将pscp命令发布到命令行或MSDOS,如下所示。

> pscp
Help and Options
Help and Options
帮助和选项

We can see that the usage or syntax of the pscp command is provided the start of the help information. Also, all available options are printed after the Options: part.

我们可以看到,帮助信息的开头提供了pscp命令的用法或语法。 同样,所有可用的选项均在“ Options:部分之后打印。

从远程服务器下载或获取文件 (Download or Get File From Remote Server)

We will start with a simple example where we will download or get a single file from a remote server or system. As stated previously we will use SSH protocol for connection and transfer. We will just provide the remote system user name, IP address or hostname and the file with its absolute path. We will also provide the file name we want to save locally.

我们将从一个简单的示例开始,在该示例中,我们将从远程服务器或系统下载或获取单个文件。 如前所述,我们将使用SSH协议进行连接和传输。 我们将只提供远程系统用户名,IP地址或主机名以及带有其绝对路径的文件。 我们还将提供要保存在本地的文件名。

pscp [email protected]:/PATH/FILE  FILE
> pscp [email protected]:/home/ismail/pass pass.txt
Download or Get File From Remote Server
Download or Get File From Remote Server
从远程服务器下载或获取文件

We can see that for the first time we will connect a server we need to approve the remote server puıblic key. Then we provide the password for the user ismail. After we authenticated successfully the transfer of the file is completed successfully.

我们可以看到,这是我们第一次连接服务器,我们需要批准远程服务器的公共密钥。 然后,我们为用户ismail提供密码。 成功通过身份验证后,文件传输成功完成。

LEARN MORE  How To Find And Change SSH Port Number?
了解更多如何查找和更改SSH端口号?

从远程服务器下载或获取多个文件 (Download or Get Multiple Files From Remote Server)

In the previous example, we have downloaded or got a single file from the remote server. We can also download and get multiple files from a remote system according to their path or file extension.

在上一个示例中,我们已经从远程服务器下载或获得了一个文件。 我们还可以根据其路径或文件扩展名从远程系统下载并获取多个文件。

In this example we will download all gzipped file with the gz extension those resides /home/ismail . . means we will save to the current working directory.

在此示例中,我们将下载所有驻留在/home/ismailgz扩展名的gzipped文件。 . 表示我们将保存到当前工作目录。

> pscp [email protected]:/home/ismail/*.gz .
Download or Get Multiple Files From Remote Server
Download or Get Multiple Files From Remote Server
从远程服务器下载或获取多个文件

上载或放置文件到远程服务器(Upload or Put File To Remote Server)

We can also upload or put given file to the remote SSH server with the pscp command. We will first provide the file name and then provide the remote system user name, IP address or Host name and the path we want to put.

我们还可以使用pscp命令将给定文件上传或放置到远程SSH服务器中。 我们将首先提供文件名,然后提供远程系统用户名,IP地址或主机名以及我们要放置的路径。

pscp  FILE [email protected]:/PATH/FILE
> pscp pass.txt [email protected]:/home/ismail/pass.txt
Upload or Put File To Remote Server
Upload or Put File To Remote Server
上载或放置文件到远程服务器

将文件上传或放置到远程服务器(Upload or Put Files To Remote Server)

We can also put multiple files to the remote server with pscp command. We will provide the file names before the remote server, user information. In this example, we will copy local files pass.txt, config.sys to the remote server.

我们还可以使用pscp命令将多个文件放入远程服务器。 我们将在远程服务器之前提供文件名,用户信息。 在此示例中,我们将本地文件pass.txtconfig.sys复制到远程服务器。

pscp  FILE1 FILE2 ... FILEN  [email protected]:/PATH/FILE
> pscp pass.txt config.sys  [email protected]:/home/ismail/
Upload or Put Files To Remote Server
Upload or Put Files To Remote Server
将文件上传或放置到远程服务器

从远程服务器递归下载或获取目录(Download or Get Directories Recursively From Remote Server)

If we want to get remote directories and download local we need to use recursive options which is -r.

如果要获取远程目录并下载本地目录,则需要使用-r递归选项。

> pscp -r [email protected]:/home/ismail/ .

递归上载或放置目录到远程服务器 (Upload or Put Directories Recursively To Remote Server)

We can also send or upload local directories to the remote server. We will again use the -r option.

我们还可以将本地目录发送或上传到远程服务器。 我们将再次使用-r选项。

> pscp -r Downloads [email protected]:/home/ismail/Downloads/

We will put local directory  name Downloads to the remote server 192.168.142.144 and folder /home/ismail/Downloads

我们将把本地目录名称Downloads放到远程服务器192.168.142.144和文件夹/home/ismail/Downloads

翻译自: https://www.poftut.com/how-to-use-pscp-command-on-windows/

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值