宝塔服务器面板,一键全能部署及管理,送你10850元礼包,点我领取

FTP是C/S类型的软件,需要FTP客户端才能连接到服务端。 典型的FTP客户端包括以下:

浏览器:通过在浏览器中输入ftp://ip或ftp://域名,3分钟即可了解计算机的发展历史——群学访问FTP

可以使用ftp命令从客户端:的命令行进行连接

三方客户端: FileZilla 8uftp图形软件或文本界面的lftp等

在三种方式中,文本接口很麻烦,不能进行鼠标流。 所以我重点向大家说明

1 )登录文本接口

文本接口的匿名登录

[ root @ localhost~] # FTP 192.168.11.16

连接到192.168.11.16 192.168.11.16 )。

20vsftpd3.0.3)。

name192.168.11.16:根) : ftp #用户名可以是ftp或anonymous

331 Please specify the password。

Password: #密码为空

230 Login successful. #显示登录成功

远程系统类型is UNIX。

使用二进制模式到传输文件。

ftp ls

27企业通道模式192、168、11、16、90、35 )。

150 herecomesthedirectorylisting。

drwxr-xr-x 2 0 0 6 May 14 2019 pub

226目录发送确定。

在ls中,可以看到当前目录下有一个名为pub的目录

ftp pwd

257 ‘/’

使用pwd命令检查当前路径。 请注意,此处显示了FTP的根目录

ftp bye

221谷歌。

结束bye命令的使用

文本界面的本地用户登录

[ root @ localhost~] # FTP 192.168.11.16

连接到192.168.11.16 192.168.11.16 )。

20vsftpd3.0.3)。

name192.168.11.16:路线) :晕圈

331 Please specify the password。

Password:

230 Login successful。

远程系统类型is UNIX。

使用二进制模式到传输文件。

ftp ls

27企业通道模式192、168、11、16、130、240 )。

150 herecomesthedirectorylisting。

rwxr-xr-x 2100110016 Jan 1508:56下载

rwxr-xr-x 2100110016 Jan 1508336056公共

rwxr-xr-x 2100110016 Jan 1508:56图像

rwxr-xr-x 2100110016 Jan 1508336056文档

rwxr-xr-x 2100110016 Jan 1508336056台式机

rwxr-xr-x 2100110016 Jan 1508336056模板

rwxr-xr-x 2100110016 Jan 1508336056视频

rwxr-xr-x 2100110016 Jan 1508:56音乐

226目录发送确定。

ftp pwd

257 ‘/home/hello ‘ isthecurrentdirectory

2 ) FTP客户端的常规命令

输入help命令可显示所有可用的命令

Ftp帮助

commandsmaybeabbreviated.commands are :

! 调试mdir send port site

$                dir           mget           put          size

account          disconnect    mkdir          pwd          status

append           exit          mls            quit         struct

ascii            form          mode           quote        system

bell             get           modtime        recv         sunique

binary           glob          mput           reget        tenex

bye              hash          newer          rstatus      tick

case             help          nmap           rhelp        trace

cd               idle          nlist          rename       type

cdup             image         ntrans         reset        user

chmod            lcd           open           restart      umask

close            ls            prompt         rmdir        verbose

cr               macdef        passive        runique        ?

delete           mdelete       proxy          send

!+linux命令   执行系统命令

!ls /opt  显示linux系统中/opt目录下的内容

ftp> !ls /opt

dhcp  dns  rh

lcd linux系统中的当前目录

lcd /root  将linux系统中的当前目录切换到/root下

ftp> lcd /root

Local directory now /root

put 上传命令,mput批量上传命令

上传initial-setup-ks.cfg文件到hello家目录下

ftp> put initial-setup-ks.cfg

local: initial-setup-ks.cfg remote: initial-setup-ks.cfg

227 Entering Passive Mode 192,168,11,16,96,132).

150 Ok to send data.

226 Transfer complete.

1803 bytes sent in 0.00135 secs 1333.58 Kbytes/sec)

可以看到上传成功了

验证一下上传结果

ftp> ls

227 Entering Passive Mode 192,168,11,16,173,142).

150 Here comes the directory listing.

-rw-r–r–    1 1000     1000         1803 Feb 26 07:01 initial-setup-ks.cfg

drwxr-xr-x    2 1000     1000            6 Jan 11 01:37 下载

drwxr-xr-x    2 1000     1000            6 Jan 11 01:37 公共

drwxr-xr-x    2 1000     1000            6 Jan 11 01:37 图片

drwxr-xr-x    2 1000     1000            6 Jan 11 01:37 文档

drwxr-xr-x    2 1000     1000            6 Jan 11 01:37 桌面

drwxr-xr-x    2 1000     1000            6 Jan 11 01:37 模板

drwxr-xr-x    2 1000     1000            6 Jan 11 01:37 视频

drwxr-xr-x    2 1000     1000            6 Jan 11 01:37 音乐

226 Directory send OK.

看见了吧

切换linux当前目录到/tmp

ftp> lcd /tmp

Local directory now /tmp

get下载命令,mget批量下载

下载initial-setup-ks.cfg到linux系统当前目录/tmp

ftp> get initial-setup-ks.cfg

local: initial-setup-ks.cfg remote: initial-setup-ks.cfg

227 Entering Passive Mode 192,168,11,16,229,134).

150 Opening BINARY mode data connection for initial-setup-ks.cfg 1803 bytes).

226 Transfer complete.

1803 bytes received in 2.9e-05 secs 62172.41 Kbytes/sec)

列出linux目录/tmp的内容,看到了下载的文件initial-setup-ks.cfg

ftp> !ls /tmp/

dhcp                                          tracker-extract-files.0

initial-setup-ks.cfg                                  VMwareDnD

systemd-private-8e7a99ea89c14ab396d66116970fe04d-chronyd.service-sghHHs       vmware-root

systemd-private-8e7a99ea89c14ab396d66116970fe04d-colord.service-wK7h08      yum_save_tx.2019-02-20.16-10.Z6uXqR.yumtx

systemd-private-8e7a99ea89c14ab396d66116970fe04d-cups.service-cokBro          yum_save_tx.2019-02-21.09-03.08zIbU.yumtx

systemd-private-8e7a99ea89c14ab396d66116970fe04d-rtkit-daemon.service-6wt1S0  yum_save_tx.2019-02-22.11-10.prawAT.yumtx

ftp> close

221 Goodbye.

ftp> ls

Not connected.

可以使用close断开连接,当连接断开希望再次连接直接使用open命令即可

ftp> open 192.168.11.16

Connected to 192.168.11.16 192.168.11.16).

220 vsFTPd 3.0.2)

Name 192.168.11.16:root): hello

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 192,168,11,16,192,88).

150 Here comes the directory listing.

-rw-r–r–    1 1000     1000         1803 Feb 26 07:01 initial-setup-ks.cfg

drwxr-xr-x    2 1000     1000            6 Jan 11 01:37 下载

drwxr-xr-x    2 1000     1000            6 Jan 11 01:37 公共

drwxr-xr-x    2 1000     1000            6 Jan 11 01:37 图片

drwxr-xr-x    2 1000     1000            6 Jan 11 01:37 文档

drwxr-xr-x    2 1000     1000            6 Jan 11 01:37 桌面

drwxr-xr-x    2 1000     1000            6 Jan 11 01:37 模板

drwxr-xr-x    2 1000     1000            6 Jan 11 01:37 视频

drwxr-xr-x    2 1000     1000            6 Jan 11 01:37 音乐

226 Directory send OK.

delete命令可以删除属于自己的文件

删除initial-setup-ks.cfg文件

ftp> delete initial-setup-ks.cfg

250 Delete operation successful.

ftp> ls

227 Entering Passive Mode 192,168,11,16,168,142).

150 Here comes the directory listing.

drwxr-xr-x    2 1000     1000            6 Jan 11 01:37 下载

drwxr-xr-x    2 1000     1000            6 Jan 11 01:37 公共

drwxr-xr-x    2 1000     1000            6 Jan 11 01:37 图片

drwxr-xr-x    2 1000     1000            6 Jan 11 01:37 文档

drwxr-xr-x    2 1000     1000            6 Jan 11 01:37 桌面

drwxr-xr-x    2 1000     1000            6 Jan 11 01:37 模板

drwxr-xr-x    2 1000     1000            6 Jan 11 01:37 视频

drwxr-xr-x    2 1000     1000            6 Jan 11 01:37 音乐

226 Directory send OK.

总结

都有哪些方法可以连接ftp服务器

文本方式如何连接

在文本界面中有哪些操作

重点:如何使用ftp命令在文本界面下连接ftp服务器

难点:区分清楚何时操作的是ftp服务器的内容,何时操作的是本地的内容

版权申明:本站文章均来自网络,如有侵权,请联系01056159998 邮箱:itboby@foxmail.com

特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有