What is FTP
FTP is an acronym for File Transfer Protocol. As the name implies, FTP is used to transfer files between computers on a network, such as the Internet. You can use FTP to exchange files between computer accounts, and for fast file transfers between an account and a desktop computer, or to access software archives on the Internet.
Using the File Transfer Protocol (FTP)
- Graphical FTP clients: Using graphical FTP clients simplifies file transfers by allowing you to drag files back and forth between computers (usually between your computer and a remote computer). When you open the program, you will have to enter the name of the FTP host (e.g.,
ftp.urlsite.org
) and your username and password. If you are logging into an anonymous FTP server, you may not have to enter anything. Two common FTP programs are WS-FTP Pro (for Windows) and Transmit (for MAC). - Web browser: You can use a Web browser to connect to FTP addresses exactly as you would to connect to HTTP addresses. Using a Web browser for FTP transfers makes it easy for you to browse large directories and read and retrieve files. Your Web browser will also take care of some of the details of connecting to a site and transferring files. While this method is convenient, Web browsers are often slower, less reliable, and have fewer features than other ways of using FTP.To use your Web browser to connect to an FTP site such as
ftp.urlsite.org
, where you normally enter a URL, you would enter:ftp://ftp.urlsite.org/ - Command line FTP: You can also use FTP in a command line format from your Unix account, or your Unix or DOS workstation. For example, to start FTP, at the command line prompt, enter:ftp ftp.urlsite.org
- If you are connecting to your own account, enter your username and password.
- If you are connecting to an anonymous FTP site, for your username, enter
anonymous
. For your password, enter your e-mail address.
Keep track of your files
Even if you are using a desktop computer to log into a Unix shell account, the files you transfer in an FTP session started from your Unix shell account will be stored in the directory of your account, and not on the hard drive of your desktop computer.
If you connect via Ethernet or Internet and run an FTP program (WS-FTP Pro or Hummingbird) from your desktop computer, the files will usually transfer to your hard drive.
Anonymous FTP
Many universities, government agencies, companies, and private individuals have set up publicly accessible archives on the Internet. There are thousands of these sites that contain a myriad of programs, data files, and informational text. At these sites, public directories and files that may be read by the rest of the world via FTP are set aside. These directories are usually named /pub
. Specific directions and information about the site are contained in greeting messages or files with names like README
.
Remember that anonymous FTP is a privilege granted by the organization that owns the computer to which you are connecting. Some general guidelines for using anonymous FTP are:
- Don’t transfer files you don’t need.
- Don’t transfer an excessive amount of material.
- Restrict your transfers to off-peak hours, if possible.
Many FTP sites are heavily used and require several attempts before connecting.
Common FTP commands
Some FTP commands are the same on different computers, but others are not. You can usually get a list of commands if you enter help
or ?
(question mark) at the ftp>
prompt. Some computers, such as Unix systems, may offer online information about FTP. Try man ftp
, man ftpd
, or help ftp
at your computer’s operating system prompt.
Note: FTP clients with graphical user interfaces, such as Transmit, Rapid Filer, and WS-FTP, usually do not require you to know and use these commands regularly. You may have a few occasions to use them if the program also has a command line interface.
Some useful FTP commands available on most systems include:
ascii |
Switch to ASCII mode. ASCII mode is the default mode and is used for transferring text files. |
binary |
Switch to binary mode. Use to transfer binary files, including files ending in .zip , .tar , .Z , and .gz , executable programs, graphics files, etc. |
bye (or quit ) |
Close the connection to the remote computer and exit FTP. |
cd |
Change the directory on the remote computer. |
close |
Close the connection to the remote computer. |
del |
Delete files from the remote computer. |
dir (or ls ) |
List the files in the current directory on the remote computer. |
get |
Copy a file from the remote computer to the local computer. |
hash |
Displays a # on the screen for every block of bytes transferred. A block is 1024 bytes in some cases, 2048 in others, but is between 1024 and 4096 in most cases. Check FTP’s online help for the number represented in the FTP program you are using. |
help (or ? ) |
Lists or provides help on the use of FTP commands. |
lcd |
Change the directory on the local computer. |
lpwd |
Shows the current directory (present working directory) on the local computer. This command is not available in all FTP versions. On Unix systems, try !pwd if lpwd doesn’t work. |
mdel |
Delete multiple files on the remote computer. |
mget |
Copy multiple files from the remote computer to the local computer. |
mkdir |
Create a directory on the remote host. |
mput |
Copy multiple files from the local computer to the remote computer. |
open |
Open a connection to a remote computer. |
prompt |
Turn on (or turn off) file transfer prompting. Often used to turn off prompting when using mdel , mput , or mget so that you are not required to confirm the transfer of each file before it is transferred. |
put |
Copy a file from the local computer to the remote computer. |
pwd |
Show the current directory (present working directory) on the remote computer. |
rmdir |
Remove a directory on the remote host (usually has to be empty). |
user |
Log into the remote computer to which you are currently connected. FTP will ask for a login name and possibly a password. |
! |
In Unix, exit to the shell prompt, where you can enter commands. Enter exit to get back to FTP. If you follow ! with a command (e.g., !pwd ), FTP will execute the command without dropping you to the Unix prompt. |