UNIX / Linux keyboard.

How To Use FTP

URLs for FTP

Clued-in people will write a URL as shorthand for anonymous FTP:
 ftp://ftp.openbsd.org/pub/OpenBSD/5.6/amd64/*.tgz 

That does not mean that you have to use a web browser, and it does not mean that you should try typing that as a command! Instead, it means:

The following provides step-by-step directions.

FTP, Step by Step

First of all, make sure that you are in an appropriate place to download files. Wherever you are, that's where they will be stored. Perhaps you should first:

$ cd /tmp

Use the ftp command:

$ ftp wherever.example.com

When you are prompted, log in. Are you trying to use anonymous FTP? Then use a username of ftp and then type anything as the password. The server will ask for your e-mail address, but very few servers verify if what you type looks valid.

Once connected, use the commands cd, pwd, and dir to find your way around. The first two work the same way they do on Unix or in a Windows command window, while dir acts like Unix ls -l (and therefore much like Window dir).

Use the command bin to make sure that the server does not mangle your file with the unneeded Windows-to-UNIX conversion.

If you want some feedback that things are really happening during an otherwise long and boring (and mysterious!) download, turn on the printing of a "#" for every kilobyte downloaded with the hash command.

To get only one file named whatever:

ftp> get whatever

To get many files without being prompted to type "y" before each one:

ftp> prompt
ftp> mget *.rpm *.tar.gz

Are you instead trying to upload files? Then you want to use put and mput instead of get and mget

Making Things Even Easier With wget

The wget command can make things even easier! You can just do this:

$ wget ftp://wherever.example.com/whatever

You can also use wild cards, if you are careful to hide them from the command shell:

$ wget 'ftp://wherever.example.com/w*pdf'

Real power users with plenty of disk space can tell wget to recursively pull down an entire FTP archive:

$ wget -r ftp://wherever.example.com/

That command will create a new directory named wherever.example.com and populate it with all the subdirectories and files found on that FTP server.

Still Baffled?

Read the on-line FTP manual page.

That's the OpenBSD manual page, but it should be close enough for any reasonable FTP client implementation.

Back to the Linux page