Forward from: https://www.server-world.info/en/note?os=CentOS_7&p=ftp&f=2

Thanks for your share!

[1] Install FTP Client.
[root@dlp ~]#

yum -y install lftp
[2] The connection with root account is prohibited by default, so access with an common user to FTP Server.
# lftp [option] [hostname]

[redhat@dlp ~]$

lftp -u cent www.srv.world 

Password:

# password of the user

lftp cent@www.srv.world:~>

# show current directory on FTP server

lftp cent@www.srv.world:~>

pwd

ftp://cent@www.srv.world

# show current directory on local server

lftp cent@www.srv.world:~>

!pwd

/home/redhat

# show files in current directory on FTP server

lftp cent@www.srv.world:~>

ls
drwxr-xr-x    2 1000     1000           23 Jul 19 01:33 public_html
-rw-r--r-- 1 1000 1000 399 Jul 20 16:32 test.py
# show files in current directory on local server

lftp cent@www.srv.world:~>

!ls -l
total 12
-rw-rw-r-- 1 redhat redhat 10 Jul 20 14:30 redhat.txt
-rw-rw-r-- 1 redhat redhat 10 Jul 20 14:59 test2.txt
-rw-rw-r-- 1 redhat redhat 10 Jul 20 14:59 test.txt
# change directory

lftp cent@www.srv.world:~>

cd public_html

lftp cent@www.srv.world:~/public_html>

pwd

ftp://cent@www.srv.world/%2Fhome/cent/public_html

# upload a file to FTP server
# "-a" means ascii mode ( default is binary mode )

lftp cent@www.srv.world:~>

put -a redhat.txt

22 bytes transferred
Total 2 files transferred
lftp cent@www.srv.world:~>

ls
drwxr-xr-x    2 1000     1000           23 Jul 19 01:33 public_html
-rw-r--r-- 1 1000 1000 10 Jul 20 17:01 redhat.txt
-rw-r--r-- 1 1000 1000 399 Jul 20 16:32 test.py
-rw-r--r-- 1 1000 1000 10 Jul 20 17:01 test.txt
# upload some files to FTP server

lftp cent@www.srv.world:~>

mput -a test.txt test2.txt

22 bytes transferred
Total 2 files transferred
lftp cent@www.srv.world:~>

ls
drwxr-xr-x    2 1000     1000           23 Jul 19 01:33 public_html
-rw-r--r-- 1 1000 1000 399 Jul 20 16:32 test.py
-rw-r--r-- 1 1000 1000 10 Jul 20 17:06 test.txt
-rw-r--r-- 1 1000 1000 10 Jul 20 17:06 test2.txt
# download a file from FTP server
# "-a" means ascii mode ( default is binary mode )

lftp cent@www.srv.world:~>

get -a test.py

416 bytes transferred

# download some files from FTP server

lftp cent@www.srv.world:~>

mget -a test.txt test2.txt

20 bytes transferred
Total 2 files transferred

# create a directory in current directory on FTP Server

lftp cent@www.srv.world:~>

mkdir testdir

mkdir ok, `testdir' created
lftp cent@www.srv.world:~>

ls
drwxr-xr-x    2 1000     1000           23 Jul 19 01:33 public_html
-rw-r--r-- 1 1000 1000 399 Jul 20 16:32 test.py
-rw-r--r-- 1 1000 1000 10 Jul 20 17:06 test.txt
-rw-r--r-- 1 1000 1000 10 Jul 20 17:06 test2.txt
drwxr-xr-x 2 1000 1000 6 Jul 20 17:16 testdir
226 Directory send OK.
# delete a direcroty in current directory on FTP Server

lftp cent@www.srv.world:~>

rmdir testdir

rmdir ok, `testdir' removed
lftp cent@www.srv.world:~>

ls
drwxr-xr-x    2 1000     1000           23 Jul 19 01:33 public_html
-rw-r--r-- 1 1000 1000 399 Jul 20 16:32 test.py
-rw-r--r-- 1 1000 1000 10 Jul 20 17:06 test.txt
-rw-r--r-- 1 1000 1000 10 Jul 20 17:06 test2.txt
# delete a file in current directory on FTP Server

lftp cent@www.srv.world:~>

rm test2.txt

rm ok, `test2.txt' removed
lftp cent@www.srv.world:~>

ls
drwxr-xr-x    2 1000     1000           23 Jul 19 01:33 public_html
-rw-r--r-- 1 1000 1000 399 Jul 20 16:32 test.py
-rw-r--r-- 1 1000 1000 10 Jul 20 17:06 test.txt
# delete some files in current directory on FTP Server

lftp cent@www.srv.world:~>

mrm redhat.txt test.txt

rm ok, 2 files removed
lftp cent@www.srv.world:~>

ls
drwxr-xr-x    2 1000     1000           23 Jul 19 01:33 public_html
# execute commands with "![command]"

lftp cent@www.srv.world:~>

!cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
...
...
redhat:x:1001:1001::/home/redhat:/bin/bash
# exit

lftp cent@www.srv.world:~>

quit

221 Goodbye.

How to use FTP的更多相关文章

  1. 8.仿阿里云虚拟云服务器的FTP(包括FTP文件夹大小限制)

    平台之大势何人能挡? 带着你的Net飞奔吧!:http://www.cnblogs.com/dunitian/p/4822808.html#iis 原文:http://dnt.dkill.net/Ar ...

  2. Hyper-V无法文件拖拽解决方案~~~这次用一个取巧的方法架设一个FTP来访问某个磁盘,并方便的读写文件

    异常处理汇总-服 务 器 http://www.cnblogs.com/dunitian/p/4522983.html 服务器相关的知识点:http://www.cnblogs.com/dunitia ...

  3. 阿里云学生优惠Windows Server 2012 R2安装IIS,ftp等组件,绑定服务器域名,域名解析到服务器,域名备案,以及安装期间错误的解决方案

     前言: 这几天终于还是按耐不住买了一个月阿里云的学生优惠.只要是学生,在学信网上注册过,并且支付宝实名认证,就可以用9块9的价格买阿里云的云服务ECS.确实是相当的优惠. 我买的是Windows S ...

  4. win7下利用ftp实现华为路由器的上传和下载

    win7下利用ftp实现华为路由器的上传和下载 1.  Win7下ftp的安装和配置 (1)开始->控制面板->程序->程序和功能->打开或关闭Windows功能 (2)在Wi ...

  5. Java实现FTP文件与文件夹的上传和下载

    Java实现FTP文件与文件夹的上传和下载 FTP 是File Transfer Protocol(文件传输协议)的英文简称,而中文简称为"文传协议".用于Internet上的控制 ...

  6. centos下开启ftp服务

    如果要ftp访问linux需要安装ftp服务,vsftpd是Linux下比较好的的FTP服务器. 一.检查安装vsftp //检查是否安装vsftpd rpm -qa | grep vsftpd // ...

  7. 解决开启服务器防火墙导致ftp不能连接的问题

    在防火墙设置的"高级"选项卡中的"网络连接设置"--"本地连接"--"设置"中添加了"FTP服务器" ...

  8. centos6.5 nginx-1.8.0和ftp搭建图片服务器

    一.Nginx的安装步骤 1.Nginx安装环境: gcc: 安装nginx需要先将官网下载的源码进行编译,编译依赖gcc环境,如果没有gcc环境,需要安装gcc:yum install gcc-c+ ...

  9. Jenkins配置MSBuild实现自动部署(MSBuild+SVN/Subversion+FTP+BAT)

    所要用到的主要插件: [MSBuild Plugin] 具体操作: 1.配置MSBuild的版本 [系统管理]->[Global Tool Configuration]->[MSBuild ...

  10. [CentOs7]搭建ftp服务器(2)——添加用户

    摘要 上篇文章完成了ftp服务器的安装与匿名访问的内容,当然出于安全的考虑是不允许匿名访问服务器的,所以就有了本篇的内容 ,为ftp服务器添加用户,用改用户进行访问. vsftpd添加用户 FTP用户 ...

随机推荐

  1. 封装RabbitMQ.NET Library 的一点经验总结

    这篇文章内容会很短,主要是想给大家分享下我最近在做一个简单的rabbitmq客户端类库的封装的经验总结,说是简单其实一点都不简单.为了节省时间我主要按照Library的执行顺序来介绍,在你看来这里仅仅 ...

  2. C++ 重载、重写、重定义

    出自:http://blog.163.com/clevertanglei900@126/blog/ 1 成员函数重载特征: a 相同的范围(在同一个类中) b 函数名字相同 c 参数不同 d virt ...

  3. iOS AppIcon尺寸和上传ITunes构建版本尺寸

    避免忘记. 记录一下 App Icon: 29X2940X4058X5876X7687X8780X80120X120152X152167X167180X180 ITunes构建版本: 1242 x 2 ...

  4. JQuery日历控件

    日历控件最后一弹——JQuery实现,换汤不换药.原理一模一样,换了种实现工具.关于日历的终于写完了,接下来研究研究nodejs.嗯,近期就这点事了. 同样还是将input的id设置成calendar ...

  5. java并发编程学习: 守护线程(Daemon Thread)

    在正式理解这个概念前,先把 守护线程 与 守护进程 这二个极其相似的说法区分开,守护进程通常是为了防止某些应用因各种意外原因退出,而在后台独立运行的系统服务或应用程序. 比如:我们开发了一个邮件发送程 ...

  6. java并发编程学习: 阻塞队列 使用 及 实现原理

    队列(Queue)与栈(Stack)是数据结构中的二种常用结构,队列的特点是先进先出(First In First Out),而Stack是先进后出(First In Last Out),说得通俗点: ...

  7. JSON.net 在实体类中自定义日期的格式

    定义日期格式转换类,其继承 IsoDateTimeConverter,代码如下: public class DateTimeConverter : IsoDateTimeConverter { pub ...

  8. JS获取回车事件(兼容各浏览器)

    一.用到onkeydown获取事件动作, 二.用到键盘对应代码keyCode, 三. var event=arguments.callee.caller.arguments[0]||window.ev ...

  9. 《如何在大学里脱颖而出(How to Win at College)》读书笔记

    <如何在大学里脱颖而出(How to Win at College)>读书笔记 图书简介 中文版: 英文版: 作者卡尔·纽波特(Cal Newport)于 2004 年6月以优等生荣誉学会 ...

  10. iOS——学习网址收集+如何提高iOS开发技能

    1 一个比系统自带的终端好用的软件:http://www.iterm2.com 2 学习和遇到技术问题可以去的网站: CocoaChina      http://developer.cocoachi ...