mac 终端 使用ftp命令
Mac下使用命令行登陆ftp
最近使用forklift下载服务器pureftp上的东西,总是断断续续的,经常下载到99%然后显示下载失败,非常不舒服!原以为是forklift的问题,换了transmit发现同样有这样的现象。看来是ftp服务器搭的有问题~~不过因为用的不多,目前懒的解决了,暂时用Mac的终端命令来用着。其实效率也是蛮高的哦=。=
默认的本地目录是home。 输入help即可获得所有命令的帮助。
连接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
浏览文件
命令和Windows、Linux的命令基本相同
ftp> cd Documents
ftp> ls
ftp> dir
下载上传文件
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
断开连接
bye:中断与服务器的连接。
ftp> bye
大部分的命令如下,可敲入
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命令的更多相关文章
- mac 终端查看端口命令
查看 端口所在线程 lsof -i:8080 mac-abeen:spider abeen$ lsof -i:8080 COMMAND PID USER FD TYPE DEVICE SIZE/OFF ...
- mac 终端经常使用命令(三)
基本命令 1.列出文件 ls 參数 文件夹名 例: 看看驱动文件夹下有什么:ls /System/Library/Extensions 參数 -w 显示中文,-l 具体信息. -a 包含 ...
- MAC终端中tree命令
Mac没有自带的tree命令,需要额外安装才可以,操作方法有两种: 一.用find命令模拟tree效果 1.mac下默认是没有 tree命令的,不过我们可以使用find命令模拟出tree命令的效果,如 ...
- Mac终端解压命令集合
tar 解包:tar xvf FileName.tar 打包:tar cvf FileName.tar DirName (注:tar是打包,不是压缩!) ——————————————— .gz 解压1 ...
- Mac 终端执行sql命令
https://www.cnblogs.com/sbj-dawn/p/6905930.html. 远程登录MYSQL数据库 > mysql -u username -p -h hostname ...
- 为mac终端添加tree命令
原文:http://superuser.com/questions/359723/mac-os-x-equivalent-of-the-ubuntu-tree-command/ 整理步骤如下: $ t ...
- Mac终端使用tree命令查看目录结构
使用brew管理tree扩展 brew search tree brew install tree tree
- Mac 终端—不同文件不同颜色显示,提示文字
原文地址 修改Mac终端(Terminal)里不同类型文件的显示颜色 修改Mac终端(Terminal)的提示文字 Mac终端显示/隐藏文件命令 1. 修改Mac终端(Terminal)里不同类型文件 ...
- mac 终端 使用 gnu coreutils 工具 ls 颜色显示
mac 终端默认 ls 命令无颜色显示: 1: 使用 ls -G 可以显示基本颜色 2:使用 gnu coreutils 工具 mac 终端 使用 gnu coreutils 工具 ls 颜色显示 以 ...
随机推荐
- innobackupex 还原和备份实例
InnoDB 和非 InnoDB 文件的备份都是通过拷贝文件来做的,但是实现的方式不同,前者是以page为粒度做的(xtrabackup),后者是 cp 或者 tar 命令(innobackupex) ...
- go-002-语言结构
Go 语言的基础组成有以下几个部分: 包声明package,必须在源文件中非注释的第一行指明这个文件属于哪个包, 引入包import,在开头部位使用 import 导入包,单个包 import “fm ...
- Flask系列(五)Flask实现分页
一.flask分页组件 from urllib.parse import urlencode,quote,unquote class Pagination(object): ""& ...
- 89. Gray Code(公式题)
The gray code is a binary numeral system where two successive values differ in only one bit. Given a ...
- 没的选择时,存在就是合理的::与李旭科书法字QQ聊天记录
2015,8,11,晚上,与李旭科书法字作者,在Q上聊了下 有些资料 涉及到字库设计.字库产业,对大家也有益处 按惯例 没细整理,直接发blog了 ps,9.11 靠,今天是911,早上查资料,在 f ...
- 【android】移植IOS视图响应陀螺仪交互行为
IOS有个很有趣味的特性:背景图片可以响应陀螺仪方向的变化,去改变X.Y轴上的值,从而让整个界面看着充满着灵性.具体步骤是:解锁苹果产品,在IOS7以上,摆动手势,观察桌面背景图片的变化. 刚好,我们 ...
- 使用Sed和Awk实现批量文件的文本替换
摘要: 使用 Sed 完成文本替换操作任务是非常合适的.结合 find 命令,即可实现指定批量文件的文本替换.同时给出了Awk的解决方案作为对比. 问题 现在, 我要将一个原有Java项目中的一些包及 ...
- Javaworkers团队最终项目总结
Javaworkers团队最终项目总结 小组成员 20145205武钰 20145222黄亚奇 20145235李涛 20145103冯文华 团队项目总结 案例提出及工程用时 本次项目由十一到十六周共 ...
- 关于Drupal中使用hook_schema建立数据库报错PDOException: SQLSTATE[42000]的解决办法
报错信息如下:PDOException: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too l ...
- Duilib嵌入CEF禁止浏览器响应拖拽事件
转载:http://blog.csdn.net/liuyan20092009/article/details/53819473 转载:https://blog.csdn.net/u012778714( ...