Linux下FTP命令



Linux下FTP命令
 
ftp命令使用Sample
-bash-3.00$ ftp rws60001rems.us.oracle.com(连接另外一台主机)
Connected to rws60001rems.us.oracle.com (139.185.21.141).
220 (vsFTPd 1.2.1)
Name (rws60001rems.us.oracle.com:app7740): xxxxx
331 Please specify the password.
Password:  www.2cto.com  
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
227 Entering Passive Mode (139,185,21,141,216,189)
150 Here comes the directory listing.
-rw-r--r--    1 60202384 60402384      524 Aug 08 00:37 temp1.out
 
226 Directory send OK.
ftp> pwd(ftp命令下也可以执行普通的linux命令,pwd,ls,cd...)
257 "/slot/ems2384/appmgr"
ftp> ls temp1*
227 Entering Passive Mode (139,185,21,141,178,113)
150 Here comes the directory listing.
-rw-r--r--    1 60202384 60402384      524 Aug 08 00:37 temp1.out
226 Directory send OK.  www.2cto.com  
ftp> get temp1.out(从另一台主机往本地下载文件)
local: temp1.out remote: temp1.out
227 Entering Passive Mode (139,185,21,141,126,148)
150 Opening BINARY mode data connection for temp1.out (524 bytes).
226 File send OK.
524 bytes received in 0.0017 secs (3e+02 Kbytes/sec)
ftp> put INVLTENT.plx_bk(从本机往另外一台主机上传文件)
local: INVLTENT.plx_bk remote: INVLTENT.plx_bk
227 Entering Passive Mode (139,185,21,141,109,145)
150 FILE: INVLTENT.plx_bk.1
226 File receive OK.
331776 bytes sent in 0.00457 secs (7.1e+04 Kbytes/sec)
ftp> bye(退出)
221 Goodbye.
 
命令详解
1. 连接ftp服务器
格式:ftp [hostname| ip-address]
a)在linux命令行下输入:ftp 10.18.34.115
b)服务器询问你用户名和口令,分别输入yint和相应密码,待认证通过即可。
 
2. 下载文件
下载文件通常用get和mget这两条命令。
a) get  www.2cto.com  
格式:get [remote-file] [local-file]
将文件从远端主机中传送至本地主机中.
如要获取服务器上E:\rose\1.bmp,则
ftp> get /rose/1.bmp 1.bmp (回车)
b) mget      
格式:mget [remote-files]
从远端主机接收一批文件至本地主机.
如要获取服务器上E:\rose\下的所有文件,则
ftp> cd /rose
ftp> mget *.* (回车)
注意:文件都下载到了linux主机的当前目录下。比如,在 /root/yint下运行的ftp命令,则文件都下载到了/root/yint下。
 
3.上传文件
a) put
格式:put local-file [remote-file]
将本地一个文件传送至远端主机中.
如要把本地的1.bmp传送到远端主机E:\rose,并改名为333.bmp
ftp> put 1.bmp /rose/333.bmp (回车)
b) mput  www.2cto.com  
格式:mput local-files
将本地主机中一批文件传送至远端主机.
如要把本地当前目录下所有bmp文件上传到服务器E:\rose 下
ftp> cd /rose (回车)
ftp> mput *.bmp (回车)
注意:上传文件都来自于主机的当前目录下。比如,在 /root/yint下运行的ftp命令,则只有在/root/yint下的文件linux才会上传到服务器E:\rose 下。
 
4. 断开连接
bye:中断与服务器的连接。
ftp> bye (回车)
 
 
作者 pan_tian

相关内容

    暂无相关文章