Академический Документы
Профессиональный Документы
Культура Документы
Apoorva Mohta
What is FTP?
FTP, or File Transfer Protocol, is the name of the application and the protocol used for
moving files between two hosts on a TCP/IP network.
There are two machines involved in an ftp transaction, a client machine, which is
sometimes called the local host, and a server machine, which is sometimes called the
remote host.
FTP Commands
Most ftp clients are command-oriented and many of the common commands are the same
regardless of the platform or operating system. Some commands are executed without any
arguments or parameters and some have optional or required arguments.
Abbreviations used:
Wild cards: When writing out filenames, wild cards can be used to display or transfer
multiple files. A wild card is a special character (or group of characters) that
substitutes for one or more characters in a file or directory name. The most common wild
card is the asterisk (*). The * represents any series of adjacent characters in a
filename. The * is helpful when you want to list all of the files that start or end with
the same few letters. Here are some examples of how the * can be used:
Example Explanation
read* Represents all filenames that begin with the string "read", including
names like readme.doc, readmeandweep, and read.
*html* Represents all filenames containing the string "html" anywhere in the
filename, including names like html-viewer-111.hqx, index.html, and text-
to-html-131.hqx.
*txt Represents all filenames that end with the string "txt", including names
like abstract.txt and readme.txt.
Commands for Opening a Session
user your_loginname Tell the remote host the login user ward
name of the account you will be user anonymous
using. Normally you will be
prompted for this information
when you connect to the remote
host. If you enter your login
name incorrectly, you can use
this command to enter the
correct information.
Commands for Closing a Session
quit Close the current session and quit ftp client. You will be quit
returned to the operating system prompt.
close Close the current session without quitting the ftp client. close
You will be returned to the ftp> prompt and can use the open
command to open a new session.
disconnect Disconnects from the remote computer, retaining the ftp> disconnect
prompt.
ls rdirname Display the contents of the specified directory on the remote ls /pub/pc
host
dir rdirname Display the contents of the specified directory on the remote dir
host in long format. /pub/pc
dir rfilenames Display the specified files on the remote host in long dir read*
format. dir *.txt
Note: The Examples used are for Unix (/filename). For Windows, use \filename.
cd rdirname Change to the specified directory on the remote host. When cd /pub
changing directories on a Macintosh, surround the directory
name with quotation marks.
lcd ldirname Change to the specified directory on the local host. When lcd /pub
changing directories on a Macintosh, surround the directory
name with quotation marks.
pwd Display the name of the current directory on the remote host. pwd
Commands for Specifying Transfer Type
Command Description Example
ascii Set the file transfer mode to ASCII. Use ASCII mode for text ascii
files (.txt, .doc, .asc. etc.) postscript files (.ps),
BinHexed files (.hqx), and uuencoded files (.uue).
binary Set the file transfer mode to binary. Use binary mode for binary
most executable files (except shell scripts and batch files),
formatted data files, and compressed files. Use MacBinary
mode when moving Macintosh binary files to or from a non-
Macintosh system.
get rfilename Move the specified file from the remote host to the get
[lfilename] local host. readme.first
readme.1st
mget rfilename(s) Move the specified files from the remote host to the mget nupop*
local host. You will be asked to confirm the transfer mget *
for each file. To turn this interactive prompting off, mget *.ZIP
enter the prompt command before executing the mget
command.
put lfilename Move the specified file from the local host to the put
[rfilename] remote host. myfile.zip
mput lfilename(s) Move the specified files from the local host to the mput *.ZIP
remote host. You will be asked to confirm the transfer mput *
for each file. To turn this interactive prompting off,
enter the prompt command before executing the mput
command.