FTP stands for the File Transfer Protocol. It allows you to send and receive files between two computers. There is the FTP server and the FTP client. We discuss the client in this section.
For the curious, the “client” is you. The “server” is the computer that answers your FTP request and lets you login. You will download files from and upload files to the server. The client cannot accept FTP connections, it can only connect to servers.
To connect to an FTP server, simply run the ftp(1) command and specify the host:
$ ftp <hostname> |
If the host is running an FTP server, it will ask for a username and password. You can log in as yourself or as “anonymous”. Anonymous FTP sites are very popular for software archives. For example, to get Slackware Linux via FTP, you must use anonymous FTP.
Once connected, you will be at the ftp> prompt. There are special commands for FTP, but they are similar to other standard commands. The following shows some of the basic commands and what they do:
Table 13-1. ftp Commands
Command | Purpose |
---|---|
ls | List files |
cd <dirname> | Change directory |
put <filename> | Download a file |
put <filename> | Upload a file |
hash | Toggle hash mark stats indicator |
prom | Toggle interactive mode for downloads |
mget <mask> | Download a file or group of files; wildcard are allowed |
mput <mask> | Upload a file or group of files; wildcard are allowed |
quit | Log off the FTP server |
FTP is a fairly simple program to use, but lacks the user interface that many of us are used to nowadays. The man page discusses some of the command line options for ftp(1).
ncftp(1) (pronounced “Nik-F-T-P”) is an alternative to the traditional ftp client that comes with Slackware. It is still a text-based program, but offers many advantages over ftp, including:
Tab completion
Bookmarks file
Passive and non-passive FTP transfer modes
More liberal wildcard uses
Command history
By default, ncftp will try to log in anonymously to the server you specify. You can force ncftp to present a login prompt with the “-u” option. Once logged in, you can use the same commands as in ftp, only you'll notice a nicer interface, one that works more like bash.
Figure 13-1. Example NcFTP screen.