CMMG Biocomputing Facility
Online Help Guides

Using FTP

[ Genetics Computer | GCG | Windows 95 | Online Guides | CMMG Home ]


Using FTP for File Transfers

One of the most useful tools available for computers is the ability to transfer files from one machine to another. You may use FTP (File Transfer Protocol) to copy files from one computer to another through the Internet.

NB: FTP does not check for already existing files of the same name. You should be careful not to copy over the top of an old file, because you will lose the information in the old file.

GRAPHICAL FTP PROGRAMS FOR PC AND MAC

You may install free simple-to-use graphical FTP programs on your PC or Mac, such as WS_FTP (PC) or Fetch (Mac). With those programs, you can use your mouse to select which files to transfer, without having to learn any FTP commands. You can also use these programs as a remote "file manager", since they usually allow you to copy, delete, rename, or view the contents of your remote files. These programs are available at the WSU Download Center. If you install these programs, you may not need to learn the FTP commands described below.

You may also use Netscape as an FTP client, instead of WS_FTP or Fetch. To use Netscape to log into an anonymous account on an FTP server, use an "ftp" URL like this:

       ftp://ftp.whatever.com
You can also use a full path pointing directly to a specific file on the ftp server:

       ftp://ftp.whatever.com/path/filename
To log into a specific user account on the FTP server, you can include your username. The syntax is:

       ftp://username@genetics.wayne.edu
COMMAND LINE FTP

To start a command-line FTP session, type ftp and press enter, either from the UNIX prompt, the Windows 95 Start/Run window, or the DOS prompt. That will get you to the ftp> prompt, from which you can type other FTP commands (see below).

ONLINE HELP FOR FTP COMMANDS

During an ftp session, you can see a list of ftp commands by typing help and pressing enter from the ftp> prompt, or type help command for information about any particular ftp command.

THE FTP SESSION

To initiate an ftp connection to a remote computer, you must know the Internet address of the computer, either the name or the number. For example:

genetics% ftp remote.machine.name
or
genetics% ftp 192.17.20.22
or
ftp> open remote.machine.name

which generates a response like this:

Connected to 192.17.20.22.
220 PC Resident FTP server, ready
Name (192.17.20.22:username):
The ftp server program on the remote computer will now prompt you for your username and password. Therefore, you either need to have an account on that computer or you need to access anonymous ftp. For the latter, answer anonymous when asked for name, and enter your complete E-mail address (e.g. username@genetics.wayne.edu) when asked for password.

You may also set up an FTP server program on your PC (such as NCSA telnet or QVT/Net), which would allow you to have password protected access to the files on your PC from anywhere else on the Internet.

COMMON FTP COMMANDS (issued from the ftp> prompt)

Command		Action

ascii		Sets transfer mode to ASCII (text) (default)

binary		Sets transfer mode to binary (image)

cd path		Changes to new directory on remote computer

close		Close the connection to the remote computer

dir		Lists filenames in remote computer's directory

!dir		Lists filenames in local computer's directory (or !ls)

get filename	Gets file from remote computer, sends to local computer

help		Shows online list of ftp commands

help command	Shows online description of specified ftp command

lcd path	Changes to new directory on local computer

mget files*     Gets multiple files with wild-cards * (also mput)

open hostname	Opens an ftp connection to a remote computer

prompt		Turns off prompting during mget or mput

put filename	Sends a file from local computer to remote computer

pwd		Shows current remote computer directory name

!pwd            Shows current local computer directory name

quit, bye	Exits ftp
Note: Not all FTP clients support all commands. To see which commands are available in your client, type help from the ftp> prompt.

FILE TYPE: ASCII, BINARY

An ASCII or text file can be read by humans, and can be used with standard text editors on the PC or host computer. The file you are now reading is an example of a text file. When text files are transferred between two different kinds of machines, such as UNIX and PC, the end-of-line markers may be changed.

A binary, graphics, or IMAGE file cannot be read by humans. When transferred, binary files are not changed in any way (unlike text files). Binary files include executable computer programs and formatted word processing files.

The default mode for ftp transfers is ASCII format. If you are transferring graphics or binary data files, change to binary mode before you use the put or get commands. Do this by typing the command: binary. To reset the ASCII format after sending a binary file, type the command: ascii.

CHANGING DIRECTORIES

To change from one directory to another on the remote computer, use the cd command:

cd /temp
To change from one directory to another on your local computer, use the lcd command:

lcd c:/temp
THE PUT COMMAND

To copy a file from your local computer to the remote computer, use the put command:

put filename.ext
THE GET COMMAND

To copy a file from the remote computer to your local computer, use the get command:

get filename.ext
You can rename the file during the transfer:

get oldname newname
gets a file called oldname and stores it as a file called newname.

To copy multiple files with similar names, you may use the mget command (or the mput command) with a wild card:

mget *.txt
That would copy all the files in the remote directory that end with .txt

COMPRESSED FILES

Many files that are available for ftp are stored in COMPRESSED format. Compressed files take only about half as long to transfer, which can help when you are transferring large files from remote locations. However, you will then need to uncompress the files before you can use them. Examples of files stored in compressed format include those with the extension .zip, such as filename.zip. There are also other types of compressed files. Programs that uncompress files are available by anonymous ftp. NB: use binary mode to transfer compressed files.


[ Genetics Computer | GCG | Windows 95 | Online Guides | CMMG Home ]


Send comments to: dwomble@genetics.wayne.edu

Copyright © 2003, David D. Womble.