Unix/Linux 中常用的 ftp 命令小例

FTP 是一種文件傳輸協議。用於將文件從一臺服務器轉移到另外一臺服務器,FTP是使用一個客戶端和服務端進行連接。默認端口 21;html

經過ftp鏈接到服務器。

# ftp domain.com
# ftp IP-Address-of-server 
# ftp Host-name-of-server

例子

root@server [~]# ftp domain.com
Connected to domain.com (111.222.333.111).
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 2 of 50 allowed.
220-Local time is now 08:41. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
Name (domain.com:root): USERNAME 
Password : PASSWORD

230 OK. Current restricted directory is /
Remote system type is UNIX.
Using binary mode to transfer files.

顯示文件:

ftp > ls

進入文件夾:

ftp> cd dirName

指定要更改的本地計算機上的目錄

ftp> lcd dirName

例子

ftp> lcd
Local directory now /root

ftp> lcd /home/
Local directory now /home
ftp> lcd
Local directory now /home

下載複製到本地

ftp> get .ftpquota
local: .ftpquota remote: .ftpquota
227 Entering Passive Mode (198,15,127,170,33,202)
150 Accepted data connection
226-File successfully transferred
226 0.014 seconds (measured here), 0.97 Kbytes per second
14 bytes received in 0.0122 secs (1.15 Kbytes/sec)

複製下載多個文件到本地

ftp> mget file1 file2

開關交互提示

是否驗證每一步命令linux

ftp> prompt on
Interactive mode off.
ftp> prompt off
Interactive mode on.

刪除遠程文件

ftp> delete fileName

上傳文件

ftp> put fileName

上傳多個文件

ftp> mput file1 file2

建立文件夾

ftp> mkdir dirName

刪除文件

ftp> rmdir dirName

設置文件傳輸牧師

ftp> ascii
ftp> binary

斷開 ftp

ftp> quit
Or
ftp> bye

獲取更多命令

ftp> ?
ftp> help
ftp> help commandName
英語原文:[weblink url="http://crybit.com/10-frequently-using-ftp-commands-with-example-unixlinux/"]frequently using ftp commands with example Unix/Linux[/weblink]
相關文章
相關標籤/搜索