使用簡例 :
Sparc2>ftp mail <— ftp 至中心之 mail_host
Connected to mail.ncku.edu.tw.
220 mail FTP server (SunOS 4.1) ready.
Name (mail:yang): anonymous <— 鍵入 user_name
331 Guest login ok, send ident as password.
Password: <— 鍵入 password
230 Guest login ok, access restrictions apply.
ftp> dir <— 顯示遠方主機之較詳細之目錄內容
200 PORT command successful.
200 PORT command successful.
150 ASCII data connection for /bin/ls (140.116.3.52,1509) (0 bytes).
total 35
-rw-r--r-- 1 ftp daemon 245 May 24 1992 .desc
-rw-r--r-- 1 root daemon 18 May 24 1992 .desc.note
-rw-r--r-- 1 ftp daemon 1024 Dec 15 05:00 .desc.pag
dr-xr-xr-x 2 ftp wheel 512 Sep 15 1992 bin
-r-xr-x--- 1 ftp daemon 24576 May 24 1992 describe
dr-xr-xr-x 2 ftp wheel 512 Nov 16 1992 etc
dr-xr-xr-x 12 ftp wheel 512 May 19 07:58 pub
-rw-r--r-- 1 ftp daemon 761 Apr 8 17:48 readme
-rw-r--r-- 1 ftp daemon 1242 Oct 23 1992 upload.rule
226 ASCII Transfer complete.
755 bytes received in 0.16 seconds (4.7 Kbytes/s)
ftp> cd pub/UNIX/utility <— 變換遠方主機的目錄
250 CWD command successful.
ftp> dir
200 PORT command successful.
150 ASCII data connection for /bin/ls (140.116.3.52,1510) (0 bytes).
total 50
dr-xr-xr-x 2 ftp wheel 512 Nov 10 1992 unzip
dr-xr-xr-x 2 ftp wheel 512 Nov 10 1992 unzip
-r-xr-xr-x 1 ftp daemon 48374 Dec 16 08:20 uuencode.zip
dr-xr-xr-x 2 ftp daemon 512 Dec 31 01:59 viewer
226 ASCII Transfer complete.
201 bytes received in 0.055 seconds (3.6 Kbytes/s)
ftp> bin <— 將以下檔案傳輸型式設為 binary
200 Type set to I.
ftp> get uuencode.zip <— 擷取檔案
200 PORT command successful.
150 Binary data connection for uuencode.zip (140.116.3.52,1511) (48374 bytes).
226 Binary Transfer complete.
local: uuencode.zip remote: uuencode.zip
48374 bytes received in 0.14 seconds (3.4e+02 Kbytes/s)
ftp> !ls -al uuencode.zip <— 執行本地主機的命令 ls -al
-rw------- 1 yang 48374 May 21 10:08 uuencode.zip
ftp> quit <— 結束 ftp
221 Goodbye.
Sparc2>
ftp 之命令
==========
! cr ls prompt runique
$ delete macdef proxy send
account debug mdelete sendport status
append dir mdir put struct
ascii disconnect mget pwd sunique
bell form mkdir quit tenex
binary get mls quote trace
bye glob mode recv type
case hash mput remotehelp user
cd help nmap rename verbose
cdup image ntrans reset ?
close lcd open rmdir
以下為較常用之命令 :
open [host_name] : 建立一個與遠端主機之連結
close : 結束與遠端主機之連結, 但不離開 ftp, 可再用 open 與其他主機連結
close : 結束與遠端主機之連結, 但不離開 ftp, 可再用 open 與其他主機連結
bye 或 quit : 結束與遠端主機之連結, 且離開 ftp
CTRL-C : 中斷 ftp
get rfile [lfile] : 擷取遠端主機的檔案
put lfile [rfile] 或 send lfile [rfile] : 傳送檔案至遠端主機
mget rfile [lfile] : 一次頡取多個遠端主機的檔案, 可用通配字元
mput lfile [rfile] : 一次傳送多個檔案至遠端主機, 可用通配字元
pwd : 顯示遠端主機現在那個目錄
lcd ldir : 變換本地主機之工作目錄
cd rdir : 變換遠端主機之工作目錄
ls [rdir] : 顯示遠端主機之工作目錄內容
dir [rdir] : 顯示遠端主機之工作目錄較詳細內容
dir [rdir] : 顯示遠端主機之工作目錄較詳細內容
ascii : 設定檔案傳輸型式為 ascii
binary : 設定檔案傳輸型式為 binary
prompt : 設定在用 mget mput 傳檔時, 是否要詢問使用者的回應
! lcommand : 執行本地主機的命令
(以上 lfile->local file , ldir->local directory , lcommand->local command
rfile->remote file ,rdir->remote directory)