歡迎您光臨本站 註冊首頁

Linux下FTP命令

←手機掃碼閱讀     火星人 @ 2014-03-09 , reply:0

  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:

  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 (回車)


[火星人 ] Linux下FTP命令已經有430次圍觀

http://coctec.com/docs/linux/show-post-55586.html