Windows command line using the Windows command-line FTP using FTP

Windows command line using FTP

1. System Environment

  FTP client: Windows7 Ultimate, administrator privileges command line;

  FTP server: CentOS 6.5, VSFTP, port 21 (default)

2. landing FTP

  1. Enter ftp at the command line, there ftp> that is, into the command line FTP
  2. Open  the FTP IP address / domain name  , for example, open 169.254.234.241 (easiest course directly from the command line FTP  the FTP IP address / domain name )
  3. Follow the prompts to enter a user name and password to complete the landing
Copy the code
Microsoft Windows [Version 6.1.7601] 
Copyright (c) 2009 Microsoft Corporation. all rights reserved. 

C: \ the Users \ Administrator> the FTP 
the FTP> Open 169.254.234.241 
connected to 169.254.234.241. 
220 Welcome to blah FTP service. 
User (169.254.234.241:(none)): WY 
. Please the Specify The password 331 
Password: 
230 the Login successful. 
FTP>
Copy the code

3. Upload a file

  1. put (or send, using the mput plurality upload)  the file name (including the path)  , for example, put C: \ Users \ Administrator \ Documents \ Myself.pub
  2. ls (or dir) to view the files in the current directory
Copy the code
FTP> PUT C: \ the Users \ Administrator \ Documents \ myself.pub 
. 200 is the using the Consider the PASV PORT Command successful. 
150 Ok to Send Data. 
226 Transfer Complete. 
FTP: sending 233 bytes, when 0.02 seconds 14.56 kbit / s . 
ftp> Send C: \ the Users \ Administrator \ Documents \ Myself 
. Command 200 is successful the Consider the using the PASV PORT. 
150 Ok to Send Data. 
226 Transfer Complete. 
FTP: transmitting 1004 bytes, when using 0.00 seconds 1004000.00 kbit / s 
ftp> LS 
. 200 is the using the Consider the PASV PORT Command successful. 
150 Here Comes The Directory Listing. 
Myself 
myself.pub 
226 Directory Send the OK. 
FTP: receive 20 bytes, when 0.00 seconds with 20.00 kbit / s. 
ftp>
Copy the code

  Obviously, send a lot faster than the put. But I do not have a detailed check of the difference between the two of them.

4. Download a file

  1. lcd  local directory path  set the current working directory, which is where you want to download the file. The default is the current user's home directory using the command line. I is C: \ Users \ Administrator. You can also use! Chdir view the current directory.
  2. cd  server directory  into the directory you want to download the file location on the server side in
  3. get (download multiple use mget) download the file filename. For example, get Myself
  4. ! Dir to view the files in the current directory, you can see the file you just downloaded it
Copy the code
FTP> the dir 
. 200 is the using the Consider the PASV PORT Command successful. 
150 Here Comes The Directory Listing. 
-rw-R & lt - r--. 1 500 500 03 986 On Dec 10:08 Myself 
-rw-R & lt - r--. 1 500 500 On Dec 03 10:07 myself.pub 233 
. Send the OK Directory 226 
FTP: receive 132 bytes, by 0.00 seconds when 132000.00 kbit / s. 
the FTP> cd C:! \ the Users \ Administrator \ Desktop 
the FTP> chdir! 
C: \ the Users \ Administrator 
the FTP> lcd C: \ the Users \ Administrator \ Desktop 
current local directory C: \ Users \ Administrator \ Desktop . 
the FTP> chdir! 
C: \ the Users \ Administrator \ Desktop 
the FTP> GET Myself 
. 200 PORT successful the Consider a using the Command PASV. 
the FTP: 1004 bytes received with a time of 0.00 seconds 1004.00 Kbytes / sec.
150 Opening ASCII mode data connection for Myself (986 bytes).
. 226 Transfer Complete 
FTP> the dir 
. 200 is the using the Consider the PASV PORT Command successful. 
150 Here Comes The Directory Listing. 
-Rw-R & lt - r--. 1 500 500 03 986 On Dec 10:08 Myself 
-rw-R & lt - R- -. 1 500 500 03 233 On Dec 10:07 myself.pub 
. Send the OK Directory 226 
FTP: receive 132 bytes, when 0.00 seconds with 132.00 kbit / s. 
ftp>! dir 
 drive C is no volume label. 
 Volume Serial Number is 307E-941F 

 C: \ the Users \ Administrator \ Desktop directory 

2013/12/03 18:27 <the DIR>. 
2013/12/03 18:27 <the DIR> .. 
2013/11/17 13 is: 932 Evernote.lnk 23 
2013/11/24 15:43 1,023 FlashFXP.lnk 
2013/11/21 08:53 2,176 Git Shell.lnk 
2013/11/21 08:53 GitHub.appref-MS 308 
2013/12/03 18:27 1,004 Myself
21:26 1,627 SecureCRT.lnk 2013/10/26 
               . 6 files 7,070 bytes 
               2 bytes available directory 50,591,227,904 
ftp>
Copy the code

5. Disconnect

  bye is like that.

Copy the code
ftp> status 
connected to 169.254.234.241. 
Type: ascii; Details: Open; ringing: Off; Tip: open; wildcard: Open 
Debug: OFF; hash mark Print: Off. 
the FTP> BYE 
. 221 Goodbye 

C: \ the Users \ Administrator>
Copy the code

6. Summary

  Here it is to take a clear look at a simple example for upload and download using commands. Use help and help  [the Command]  to explain the view corresponding to the command. Finally, description and format of common commands.

command Explanation format Parameter Description
bye FTP session ends with the remote computer and exits ftp bye  
cd Change the working directory on the remote computer cd RemoteDirectory
RemoteDirectory
Specified directory on the remote computer you want to change.
to you Display directory files and subdirectories on a remote computer list dir [RemoteDirectory] [LocalFile]
RemoteDirectory
Specify the directory you want to view its list. If you do not specify a directory, the current working directory on the remote computer.

 

LocalFile
Specifies the local file store list. If you do not specify a local file, the screen will display the results.
 
get

Using the current file transfer type to copy a remote file to the local computer. If no  LocalFile , the file will be assigned to  RemoteFile  name. get command with the same recv.

get RemoteFile [LocalFile]
RemoteFile
Specifies the remote file to copy.

 

LocalFile
Specify the file name to be used on the local computer.
lcd Change the working directory on the local computer. By default, the working directory is to start the  ftp  directory lcd [Directory]
Directory
Specify a directory on the local computer to be changed. If you do not specify  Directory , the current working directory on the local computer.
ls Displays a short list of files and subdirectories on a remote directory ls [RemoteDirectory] [LocalFile]  
RemoteDirectory
Specify the directory you want to view its list. If you do not specify a directory, the current working directory on the remote computer.

 

LocalFile
Specifies the local file store list. If you do not specify a local file, it will display the results on the screen.
open 与指定的 FTP 服务器连接。可以使用 IP 地址或计算机名(两种情况下都必须使用 DNS 服务器或主机文件)指定 Computer。 open Computer [Port]
Computer
必需。指定试图要连接的远程计算机。

 

Port
指定用于联系 FTP 服务器的 TCP 端口号。默认情况下,使用 TCP 端口号 21。
put(send)

使用当前文件传输类型将本地文件复制到远程计算机上。put 命令与 send 命令相同。如果没有指定 RemoteFile,文件就会赋以 LocalFile 名。 

put LocalFile [RemoteFile]
LocalFile
指定要复制的本地文件。

 

RemoteFile
指定要在远程计算机上使用的名称。

更多详细的说明请看http://technet.microsoft.com/zh-cn/library/cc756013(v=ws.10).aspx 和 http://blog.csdn.net/chaoqunz/article/details/5973317

1.系统环境

  FTP客户端:Windows7旗舰版,管理员权限命令行;

  FTP服务端:CentOS 6.5,VSFTP,端口 21(默认)

2.登陆FTP

  1. 在命令行下输入 ftp,出现 ftp>即进入FTP命令行
  2. open FTP的IP地址/域名 例如 open 169.254.234.241 (当然有最简单的方式 直接在命令行下 ftp FTP的IP地址/域名
  3. 按照提示输入用户名和密码,完成登陆
Copy the code
Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。

C:\Users\Administrator>ftp
ftp> open 169.254.234.241
连接到 169.254.234.241。
220 Welcome to blah FTP service.
用户(169.254.234.241:(none)): wy
331 Please specify the password.
密码:
230 Login successful.
ftp>
Copy the code

3.上传一个文件

  1. put(或者 send,上传多个使用 mput) 文件名(包含路径) 例如 put C:\Users\Administrator\Documents\Myself.pub
  2. ls(或者 dir) 查看当前目录文件
Copy the code
ftp> put C:\Users\Administrator\Documents\Myself.pub
200 PORT command successful. Consider using PASV.
150 Ok to send data.
226 Transfer complete.
ftp: 发送 233 字节,用时 0.02秒 14.56千字节/秒。
ftp> send C:\Users\Administrator\Documents\Myself
200 PORT command successful. Consider using PASV.
150 Ok to send data.
226 Transfer complete.
ftp: 发送 1004 字节,用时 0.00秒 1004000.00千字节/秒
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
Myself
Myself.pub
226 Directory send OK.
ftp: 收到 20 字节,用时 0.00秒 20.00千字节/秒。
ftp>
Copy the code

  很显然,send 的速度比 put 快不少。但是他们两个的区别我没有详细的查。

4.下载一个文件

  1. lcd 本地目录路径 设置当前工作路径,也就是你要把文件下载到哪。默认是在当前使用命令行的用户的主目录。我的是 C:\Users\Administrator。也可以使用 !chdir 查看当前目录。
  2. cd 服务器目录 进入到你要下载的文件在服务器端的目录位置
  3. get(下载多个用 mget) 文件名 下载该文件。例如 get Myself
  4. !dir 查看当前目录文件,就能看到你刚才下载的文件啦
Copy the code
ftp> dir
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-r--r--    1 500      500           986 Dec 03 10:08 Myself
-rw-r--r--    1 500      500           233 Dec 03 10:07 Myself.pub
226 Directory send OK.
ftp: 收到 132 字节,用时 0.00秒 132000.00千字节/秒。
ftp> !cd C:\Users\Administrator\Desktop
ftp> !chdir
C:\Users\Administrator
ftp> lcd C:\Users\Administrator\Desktop
目前的本地目录 C:\Users\Administrator\Desktop。
ftp> !chdir
C:\Users\Administrator\Desktop
ftp> get Myself
200 PORT command successful. Consider using PASV.
150 Opening ASCII mode data connection for Myself (986 bytes).
226 Transfer complete.
ftp: 收到 1004 字节,用时 0.00秒 1004.00千字节/秒。
ftp> dir
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-r--r--    1 500      500           986 Dec 03 10:08 Myself
-rw-r--r--    1 500      500           233 Dec 03 10:07 Myself.pub
226 Directory send OK.
ftp: 收到 132 字节,用时 0.00秒 132.00千字节/秒。
ftp> !dir
 驱动器 C 中的卷没有标签。
 卷的序列号是 941F-307E

 C:\Users\Administrator\Desktop 的目录

2013/12/03  18:27    <DIR>          .
2013/12/03  18:27    <DIR>          ..
2013/11/17  13:23               932 Evernote.lnk
2013/11/24  15:43             1,023 FlashFXP.lnk
2013/11/21  08:53             2,176 Git Shell.lnk
2013/11/21  08:53               308 GitHub.appref-ms
2013/12/03  18:27             1,004 Myself
2013/10/26  21:26             1,627 SecureCRT.lnk
               6 个文件          7,070 字节
               2 个目录 50,591,227,904 可用字节
ftp>
Copy the code

5.断开连接

  bye 就是这样。

Copy the code
ftp> status
连接到 169.254.234.241。
类型: ascii;详细: 开 ;铃声: 关 ;提示: 开 ;通配: 开
调试: 关 ;哈希标记打印: 关 。
ftp> bye
221 Goodbye.

C:\Users\Administrator>
Copy the code

6.总结

  这里就是拿一个例子来说明了一下简单的上传和下载命令的使用。使用 help 和 help [Command] 来查看对应命令的解释。最后给出常用命令的说明和格式。

命令 说明 格式 参数说明
bye 结束与远程计算机的 FTP 会话并退出 ftp bye  
cd 更改远程计算机上的工作目录 cd RemoteDirectory
RemoteDirectory
指定要更改的远程计算机上的目录。
dir 显示远程计算机上的目录文件和子目录列表 dir [RemoteDirectory] [LocalFile]
RemoteDirectory
指定要查看其列表的目录。如果没有指定目录,将使用远程计算机中的当前工作目录。

 

LocalFile
指定要存储列表的本地文件。如果没有指定本地文件,则屏幕上将显示结果。
 
get

使用当前文件传输类型将远程文件复制到本地计算机。如果没有指定 LocalFile,文件就会赋以 RemoteFile 名。get 命令与 recv 相同。

get RemoteFile [LocalFile]
RemoteFile
指定要复制的远程文件。

 

LocalFile
指定要在本地计算机上使用的文件名。
lcd 更改本地计算机上的工作目录。默认情况下,工作目录是启动 ftp 的目录 lcd [Directory]
Directory
指定要更改的本地计算机上的目录。如果没有指定  Directory,将显示本地计算机中的当前工作目录。
ls 显示远程目录上的文件和子目录的简短列表 ls [RemoteDirectory] [LocalFile]  
RemoteDirectory
指定要查看其列表的目录。如果没有指定目录,将使用远程计算机中的当前工作目录。

 

LocalFile
指定要存储列表的本地文件。如果没有指定本地文件,将在屏幕上显示结果。
open 与指定的 FTP 服务器连接。可以使用 IP 地址或计算机名(两种情况下都必须使用 DNS 服务器或主机文件)指定 Computer。 open Computer [Port]
Computer
必需。指定试图要连接的远程计算机。

 

Port
指定用于联系 FTP 服务器的 TCP 端口号。默认情况下,使用 TCP 端口号 21。
put(send)

使用当前文件传输类型将本地文件复制到远程计算机上。put 命令与 send 命令相同。如果没有指定 RemoteFile,文件就会赋以 LocalFile 名。 

put LocalFile [RemoteFile]
LocalFile
指定要复制的本地文件。

 

RemoteFile
指定要在远程计算机上使用的名称。

See more detailed instructions http://technet.microsoft.com/zh-cn/library/cc756013(v=ws.10).aspx  and  http://blog.csdn.net/chaoqunz/article/details/ 5973317

Guess you like

Origin www.cnblogs.com/gered/p/11118834.html