安裝
brew install telnet
brew install inetutils
brew link --overwrite inetutils
登錄
# 方式一
$ ftp ip
# 方式二
$ ftp
ftp> open ip
小知識
ftp>模式下:
cd
是服務器的稿黍,lcd
是本地的
其他的不加!
是服務器的财骨,加肋拔!
是本地的
例如:ls
是服務器具被,!ls
是本地
上傳(不支持文件夾上傳)
ascII(字符:文本)--- ftp>asc
binary (二進制:音樂,圖片,視頻等)---ftp>bin
- put (支持絕對路徑)
ftp>bin
ftp>mkdir images
ftp>put ~/Pictures/icon.jpg /ftpfile/ftp/images/a.jpg
- mput (不支持絕對路徑)
所以要cd/lcd到服務器/本地目錄下
//進入服務器目錄
ftp>cd images
ftp>pwd
/ftpfile/ftp/images
//進入本地目錄
ftp>!pwd
/Users/berning/
ftp>lcd Pictures
ftp>!pwd
/Users/berning/Pictures
ftp>prompt //注:prompt可切換交互(interactive),不用每次都輸入y/n, 每執(zhí)行一次只损,狀態(tài)就會改變一姿。
Interactive mode off.
ftp>mput icon*
下載(不支持絕對路徑| 不支持文件夾下載)
- get
//服務器
ftp>cd images
ftp>pwd
/ftpfile/ftp/images
//進入本地目錄
ftp>!pwd
/Users/berning/
ftp>lcd Downloads
ftp>!pwd
/Users/berning/Downloads
ftp>get a.jpg
- mget
//服務器目錄
ftp>cd images
ftp>pwd
/ftpfile/ftp/images
//進入本地目錄
ftp>!pwd
/Users/berning/
ftp>lcd Downloads
ftp>!pwd
/Users/berning/Downloads
ftp>prompt
Interactive mode off.
ftp>mget icon*
刪除
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-r--r-- 1 1000 1000 14388 Sep 25 04:55 a.jpeg
-rw-r--r-- 1 1000 1000 14388 Sep 25 04:56 b.jpg
-rw-r--r-- 1 1000 1000 14388 Sep 25 04:31 beard.jpeg
-rw-r--r-- 1 1000 1000 14388 Sep 25 04:56 c.png
-rw-r--r-- 1 1000 1000 231268 Sep 25 04:27 icon-1024.png
drwxr-xr-x 2 1000 1000 4096 Sep 25 04:42 images
226 Directory send OK.
//不支持
ftp> rm a.jpeg
550 Remove directory operation failed.
//需要delete
ftp> delete a.jpeg
250 Delete operation successful.