Linux下FTP命令__Linux

來源:互聯網
上載者:User

ftp命令使用Sample
-bash-3.00$ ftp site(串連另外一台主機)
Connected to site (139.185.21.141).
220 (vsFTPd 1.2.1)
Name (site:app7740): xxxxx
331 Please specify the password.
Password:
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.
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
格式: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
格式:mput local-files
將本地主機中一批檔案傳送至遠端主機.
如要把本地目前的目錄下所有bmp檔案上傳到伺服器E:\rose 下
ftp> cd /rose (斷行符號)
ftp> mput *.bmp (斷行符號)
注意:上傳檔案都來自於主機的目前的目錄下。比如,在 /root/yint下啟動並執行ftp命令,則只有在/root/yint下的檔案linux才會上傳到伺服器E:\rose 下。

4. 中斷連線
bye:中斷與伺服器的串連。
ftp> bye (斷行符號)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.