Mac下使用命令行登陆ftp

最近使用forklift下载服务器pureftp上的东西,总是断断续续的,经常下载到99%然后显示下载失败,非常不舒服!原以为是forklift的问题,换了transmit发现同样有这样的现象。看来是ftp服务器搭的有问题~~不过因为用的不多,目前懒的解决了,暂时用Mac的终端命令来用着。其实效率也是蛮高的哦=。=

默认的本地目录是home。 输入help即可获得所有命令的帮助。

  1. 连接ftp服务器

    man ftp 可以看到有这些信息。

     NAME
    ftp -- Internet file transfer program SYNOPSIS
    ftp [-46AadefginpRtvV] [-N netrc] [-o output] [-P port] [-q quittime]
    [-s srcaddr] [-r retry] [-T dir,max[,inc]] [[user@]host [port]]
    [[user@]host:[path][/]] [file:///path]
    [ftp://[user[:password]@]host[:port]/path[/][;type=X]]
    [http://[user[:password]@]host[:port]/path] [...]
    ftp -u URL file [...]

    连接服务器的话基本上就用到上面的讯息了。原本没有看man手册,一直使用

     ftp user@xxx.com port

    每次都要输入密码。后来还是用了下面这个更加简单的

     ftp ftp://user:passwd@xxx.com:port
  2. 浏览文件

    命令和Windows、Linux的命令基本相同

     ftp> cd Documents
    ftp> ls
    ftp> dir
  3. 下载上传文件

     put filename - Upload a file to the server
    
     get filename - Download a file from the server
    
     mput filename - Put multiple files on the server
    
     mget filename - Get multiple files on the server
  4. 断开连接

    bye:中断与服务器的连接。

     ftp> bye
  5. 大部分的命令如下,可敲入man ftp获得

     ls – list the contents of a directory on the FTP server
    cd – change the working directory on the FTP server
    pwd – show the current directory on the FTP server
    get – download files from the FTP server
    put – upload files to the FTP server
    account – include a password with your login information
    bye – terminate an ftp session and close ftp (or use disconnect to simply terminate a session)
    bell – make a cute sound after each file transfer is done
    chmod – change permissions
    delete – your guess is as good as mine (OK, you got me, it’s to delete a file off the server)
    glob – enable globbing
    hash – only functional in Amsterdam
    help – get help
    lpwd – print the local working directory for transfers
    mkdir – create folders on the FTP server
    rmdir – delete folders from the FTP server
    newer – only get a file if it’s newer (great for scripting synchronizations)
    nmap – use positional parameters to set filenames
    passive – use FTP passive mode
    prompt – allows the use of letters to automate answers to prompts
    rate – limit the speed of an upload or download

关于ftp,你甚至还可以写脚本进行文件操作,比如

	#!/bin/bash
ftp -d krypted.com << ftpEnd
prompt
cd /Library/WebServer/Documents
put “*.html”
put “*.php”
cd /Library/WebServer/Documents
put “*.png”
quit
ftpEnd #!/bin/bash
ftp -d krypted.com << ftpEnd
prompt
cd /My/Documents
get “*.doc”
quit
ftpEnd

在你的脚本中,可以使用以下几个字符获取一些特定的变量:

%/ – the current working directory of the FTP server
%M – the hostname of the FTP server
%m – the hostname only up to the .
%n – the username used for the FTP server

最后有一个问题,为什么老是有不明的人/机器想登陆我的FTP?= =不过自己也是只有使用的时候才会开。

mac 终端 使用ftp命令的更多相关文章

  1. mac 终端查看端口命令

    查看 端口所在线程 lsof -i:8080 mac-abeen:spider abeen$ lsof -i:8080 COMMAND PID USER FD TYPE DEVICE SIZE/OFF ...

  2. mac 终端经常使用命令(三)

    基本命令 1.列出文件 ls 參数 文件夹名        例: 看看驱动文件夹下有什么:ls /System/Library/Extensions 參数 -w 显示中文,-l 具体信息. -a 包含 ...

  3. MAC终端中tree命令

    Mac没有自带的tree命令,需要额外安装才可以,操作方法有两种: 一.用find命令模拟tree效果 1.mac下默认是没有 tree命令的,不过我们可以使用find命令模拟出tree命令的效果,如 ...

  4. Mac终端解压命令集合

    tar 解包:tar xvf FileName.tar 打包:tar cvf FileName.tar DirName (注:tar是打包,不是压缩!) ——————————————— .gz 解压1 ...

  5. Mac 终端执行sql命令

    https://www.cnblogs.com/sbj-dawn/p/6905930.html. 远程登录MYSQL数据库 > mysql -u username -p -h hostname ...

  6. 为mac终端添加tree命令

    原文:http://superuser.com/questions/359723/mac-os-x-equivalent-of-the-ubuntu-tree-command/ 整理步骤如下: $ t ...

  7. Mac终端使用tree命令查看目录结构

    使用brew管理tree扩展 brew search tree brew install tree tree

  8. Mac 终端—不同文件不同颜色显示,提示文字

    原文地址 修改Mac终端(Terminal)里不同类型文件的显示颜色 修改Mac终端(Terminal)的提示文字 Mac终端显示/隐藏文件命令 1. 修改Mac终端(Terminal)里不同类型文件 ...

  9. mac 终端 使用 gnu coreutils 工具 ls 颜色显示

    mac 终端默认 ls 命令无颜色显示: 1: 使用 ls -G 可以显示基本颜色 2:使用 gnu coreutils 工具 mac 终端 使用 gnu coreutils 工具 ls 颜色显示 以 ...

随机推荐

  1. (转)二十三种设计模式及其python实现

    本文源码寄方于github:https://github.com/w392807287/Design_pattern_of_python 参考文献: <大话设计模式>——吴强 <Py ...

  2. python16_day34【设计模式】

    一.简单工厂模式 # coding : utf-8 # create by ztypl on 2017/5/24 from abc import abstractmethod, ABCMeta cla ...

  3. 手把手教你学node之搭建node.js开发环境

    搭建node.js开发环境 本文只针对在Linux或者Mac下面.至于使用 Windows 并坚持玩新技术的同学,我坚信他们一定有着过人的.甚至是不可告人的兼容性 bug 处理能力,所以这部分同学麻烦 ...

  4. Broken pipe错误原因

      这个异常是由于以下几个原因造成. 1.客户端再发起请求后没有等服务器端相应完,点击了stop按钮,导致服务器端接收到取消请求.  通常情况下是不会有这么无聊的用户,出现这种情况可能是由于用户提交了 ...

  5. QML事件处理 八

    1.MouseArea MouseArea 是一个不可见的项目,通常用来和一个可见的项目配合使用来为其提供鼠标处理.鼠标处理的逻辑可以包含在一个MouseArea项目中. MouseArea的enab ...

  6. 清理tomcat日志大的文件

    先看一个命令: [root@weblogic logs]# catalina.--.log icatalina.--:-.out icatalina.--:-.out localhost_access ...

  7. redis未授权访问漏洞总结

    Redis是一个开源的使用ANSI C语言编写.支持网络.可基于内存亦可持久化的日志型.Key-Value数据库,并提供多种语言的API. 漏洞介绍: Redis 默认情况下,会绑定在 0.0.0.0 ...

  8. 期末总结20135320赵瀚青LINUX内核分析与设计期末总结

    赵瀚青原创作品转载请注明出处<Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 对LINUX内核分析与设计这 ...

  9. IAsyncResult接口

    #region 程序集 mscorlib.dll, v4.0.0.0 // C:\Program Files (x86)\Reference Assemblies\Microsoft\Framewor ...

  10. Java的封装性、继承性和多态性

    封装 封装隐藏了类的内部实现机制,可以在不影响使用的情况下改变类的内部结构,同时也保护了数据.对外界而已它的内部细节是隐藏的,暴露给外界的只是它的访问方法. 封装的优点: 便于使用者正确.方便的使用系 ...