Sunday, January 11, 2009

ftp What's

What's ftp?

Ftp (File Transfer Protocol) is a method for transferring files between two computers on a network. The two computers must be on the Internet. Examples of Ftp use are: to transfer files between your computer and your web space on a large computer, to transfer software or files to your computer from known Internet sites.

Ftp has two parts: the client and the server. The ftp client is a program on the computer you are using or are logged in to. The ftp server is a program on a remote computer that you want to connect to.

This handout describes the general capabilities of most ftp clients and servers. However, not all ftp programs are alike and you may find that your ftp client or the server you are connected to has slightly different behavior. In particular, the commands in this handout are presented in command line format, like that used on many large computers. IBM PC and Macintosh client software, such as WS-FTP or Fetch, present a graphical, window-oriented interface.

Starting your ftp client

On most large computers, type the ftp command to start the ftp client program:

ftp

Ftp commands

When the ftp client is started, it is ready to accept commands. Most ftp clients will prompt you for a command like this:

ftp>

Use the quit command to terminate your ftp client:

ftp> quit

Most ftp client programs will also respond with a list of available commands if you enter a "?":

ftp> ?

Connecting to a remote computer

Use the open command to connect to a remote computer. For example, to connect to CIRCA's Grove system:

ftp> open grove.ufl.edu

You will be asked for a user id and password for the remote computer. If you have an account on the remote computer and want to transfer your files, enter your user id and password.

Many computers will accept an "anonymous" ftp log in. This means that the managers of that computer will allow anyone to make an ftp connection to the computer to retrieve some public files. When asked for a username, enter anonymous. When asked for a password, it is customary to enter your electronic mail address, and some servers may require it. Using anonymous to log in is commonly called anonymous ftp.

Directory commands

Use the ls and dir commands to display the names of the files in the directory on the remote computer:

ftp> ls
ftp> dir

The ls command will send back a list of the file names. The dir command will supply expanded information, such as the date and size of the file. The format of the information depends on the type of computer the ftp server is running on.

Use the cd command to change to a different directory on the remote computer. For example, to change to the subdirectory pub/micro:

ftp> cd pub/micro

The syntax of the subdirectory might need to be in the format normally used on the remote computer. For example, for some VMS computers, you might need to enter the cd command this way:

ftp> cd [.public]

Use the lcd command to change your "local" directory. That's the current directory on your computer. You must specify the new directory in the form normally expected on your computer. For example, if you are running the ftp client program on a PC, this command will change to the root directory on diskette drive A:

ftp>lcd a:\

Commands to retrieve a file

Use the get command to transfer a file from the remote computer to your computer. For example, to get the file readme.txt from the remote computer, enter this command:

ftp> get install.txt

Some computers have file systems with case-sensitive names, so make sure you enter the name of the file using the correct case.

When you get a file you can give it a new name. The name of the file on the remote computer might not be compatible with your computer or you might prefer a different name. The new name is specified on the get command. For example, this get command specifies the new name readme.txt for the file being retrieved:

ftp> get read_me_first.txt readme.txt

Use the mget command to get a group of files. This command will get all the files ending in ".c":

ftp> mget *.c

Your ftp client may prompt you before it retrieves each file that matches. If you want it to transfer the file, enter "Y" or "YES".

Files can be transferred as either ascii or binary. An ascii file is a file containing only printable characters. A binary file can contain printable and unprintable characters. Examples of binary files are executable files or files compressed to save space.

To transfer a file in binary mode, enter the binary command before the get command:

ftp> binary
ftp> get foo.zip

WARNING: some ftp clients go back to ascii mode when you enter an ls or dir command. To be safe, always use the binary command before getting a binary file.

Commands to send a file

Use the put command to transfer a file from your computer to the remote computer. For example, this command transfers the file prog1.pas to the remote computer:

ftp> put prog1.pas

You can specify a new name for the file when it is transferred to the remote computer. For example, this put command specifies the new name prog1.p:

ftp> put prog1.pas prog1.p

If you are transferring a binary file, use the binary command before the put command:

ftp> binary
ftp> put test.exe

Use the mput command to transfer a group of files. For example, to transfer all files ending in "TXT" to the remote computer, enter this:

ftp> mput *.txt

Using ftp with CUTCP telnet

Telnet is a program used to interactively log in to a remote computer. CUTCP telnet is a program that runs on a PC and is used in CIRCA labs and elsewhere on campus to log in to remote computers. This program can also function as an ftp server when you are logged in to a remote host. This means that you can use the host's ftp client to connect back to yourself. Here's how you do it:

1. First use telnet to log in to the remote host.

2. Press Alt/T. This will generate an ftp command with the proper network address and start the ftp client program on the interactive host.

3. When it asks for a name, enter anything.

4. When it asks for a password, press Alt/W. This will provide a hidden password to authenticate the connection.

Remember that when you have completed this connection, your PC is an ftp server, and the interactive host is running an ftp client. To transfer a file from the interactive host to your PC, use the put command. To transfer a file from the PC to the interactive host, use the get command.

0 comments:

Followers

Get our toolbar!

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | JCPenney Coupons