Friday 4 August 2006

Command Line FTP on OSX

I’m going to describe the usage of the ‘ftp’ command under Unix on the Mac. Most people at some point need the use of the ftp protocol, even if they are just uploading new content to their home page. A GUI ftp client does not come with Mac but there are a few available, although most are not free.

Besides, why clutter your OS with another utility program when everything you need is available within the Terminal window and the bash shell ? You will probably also find it is quicker than most GUI solutions when you have learnt the few basic commands needed.

For this example we will assume that you wish to transfer a document invoice666.pdf to the ftp site ftp.steve.org

Start your Terminal, and at the prompt type:

ftp ftp.steve.org

You will see a response similar to this:

Connected to ftp.steve.org.
220 SJC_BIGR5 FTP server ready
Name (ftp.steve.org:stevecholerton):

Enter your logon name and press enter, you will see something similar to this:

331 Password required for bilbobaggins.
Password:


Enter your password and press enter. You will see something similar to this:

230 User bilbobaggins logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>

You now need to copy your file to the server. Note that you may change directories in the normal manner using the chdir command. To copy your file enter the following:

put invoice666.pdf

You will see a response similar to this:

local: invoice666.pdf remote: invoice666.pdf
229 Entering Extended Passive Mode (|||1670|)
150 Opening BINARY mode data connection for invoice666.pdf
100% |*********************************************| 26 0.30 KB/s 00:00
226 Transfer complete.
26 bytes sent in 00:00 (0.29 KB/s)
ftp>

Thats it. To quit the ftp program type ‘exit’ at the prompt.

If you wished to retrieve a file from the remote server you would need to use the command ‘get’ rather than ‘put’. To delete a remote file use ‘delete’. That’s all there is to it. If in doubt type a ? at the ftp prompt and all the ftp options will be listed for you. If you need further help you can type ‘man ftp’ at the command prompt ($) and the manual for the ftp command will be displayed.

"Between two evils, I always pick the one I never tried before." - Mae West

No comments: