Since I switched to Mac I need to learn a bunch of stuff I was taking for granted for years. Recently I needed to upload a bigger file or two to my server and scp
is not the tool for the job. So instead of starting a hunt for a decent free FTP client, I tried the good old command line.
自从我改用Mac之后,我需要学习很多我多年来想当然的东西。 最近,我需要将一个或两个更大的文件上传到我的服务器,而scp
并不是完成此任务的工具。 因此,我没有尝试寻找像样的免费FTP客户端,而是尝试了旧的命令行。
Turns out it's much easier to FTP files from the command line than I would think.
事实证明,从命令行通过FTP文件传输比我想象的要容易得多。
Connecting to the server
连接到服务器
$ ftp phpied.com
Connected to phpied.com.
220---------- Welcome to Pure-FTPd [TLS] ----------
220-You are user number 1 of 50 allowed.
220-Local time is now 02:17. Server port: 21.
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
Name (phpied.com:stoyan): myusername
331 User myusername OK. Password required
Password:
After supplying your credentials you're in and you have an inviting ftp>
prompt:
提供您的凭据后,您就可以进入ftp>
提示符了:
230 OK. Current restricted directory is /
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
So what do you do here? You can list available commands with ftp> help
那你在这里做什么? 您可以使用ftp> help
列出可用的命令
You can navigate with cd (good old "change directory")
您可以使用cd(旧的“更改目录”)进行导航
ftp> cd www/phpied.com/files
250 OK. Current directory is /www/phpied.com/files
You can list the contents of a remote directory with ls
or dir
.
您可以使用ls
或dir
ls
远程目录的内容。
And finally you can copy files from your desktop to the remote machine. You don't copy files, you PUT them. You're rewarded with a nice progress indicator.
最后,您可以将文件从桌面复制到远程计算机。 您不复制文件,而是放置文件。 您会得到一个不错的进度指示器。
ftp> put src.zip
local: src.zip remote: src.zip
229 Entering Extended Passive Mode (|||59237|)
150 Opening BINARY mode data connection for src.zip
10% |*** | 511 KB 64.00 KB/s 01:09 ETA
later...
后来...
ftp> put src.zip
local: src.zip remote: src.zip
229 Entering Extended Passive Mode (|||59237|)
150 Opening BINARY mode data connection for src.zip
93% |********************************** | 4607 KB 45.62 KB/s 00:07 ETA
finally...
最后...
ftp> put src.zip
local: src.zip remote: src.zip
229 Entering Extended Passive Mode (|||59237|)
150 Opening BINARY mode data connection for src.zip
100% |*************************************| 4938 KB 44.73 KB/s 00:00 ETA
226 Transfer complete.
5056569 bytes sent in 01:53 (43.55 KB/s)
And then, bye-bye:
然后,再见:
ftp> quit
221 Goodbye.
Tell your friends about this post on Facebook and Twitter
在Facebook和Twitter上告诉您的朋友有关此帖子的信息