Computing Resources SearchInfoHome
Computing Resources Home Questions and Comments


UNIX User's Guide > Command line FTP

  • What Is FTP?
  • Commonly Used FTP Commands
  • Transferring Files with FTP
  • A Sample FTP Session
  • Anonymous FTP

    What Is FTP?

    FTP is a service that allows you to transfer files between computers connected to the Internet. You run the FTP client program on your local host and use it to connect to an FTP server on a remote host. Once this connection is established, you can transfer files back and forth between the two computers. To use FTP, you'll need an account name on both the local and remote host computers. The big exception to this is anonymous FTP; see the paragraphs on anonymous FTP at the end of this section for further information.

    FTP is also available in a windows GUI interface. For more information, please see How do I transfer (upload or download) files between my PC and a remote system (Nova or Polaris)?

    < back       ^ top

    Commonly Used FTP Commands

    When you run FTP, you need to specify the system to which you'd like to connect. For example, to start an FTP session to caves.tokyo.org you'd use the following command:

         Nova> ftp caves.tokyo.org
    

    The FTP program will connect to the remote host you've specified and will then prompt you for an account name and password. Once you have successfully entered these, you will be able to start issuing FTP commands. Some useful FTP commands follow.

     Basic Commands
       help or ?    Displays a list of all FTP commands.
       quit         Quits the program.
       ! [command]  Executes a shell command from within the FTP program.
    
     Directory Commands
       cd [directory] Changes to the specified directory on the remote system.
       dir       Displays a long listing of files on the remote system.
       ls        Displays a short listing of the files on the remote system.
       lcd       Changes the working directory on the local system.
       pwd       Displays the working directory on the remote system.
    
     File Transfer Commands
       get [filename] Downloads a single file from the remote system.
       put [filename] Uploads a single file to the remote system.
       mget [file...] Downloads multiple files from the remote system.
       mput [file...] Uploads multiple files to the remote system.
    
     Miscellaneous
       ascii     Sets the file type to ASCII text.  This is the default.
       binary    Sets the file type to binary for transferring programs etc.
       prompt    Toggles yes/no prompts for multiple file transfers.
    
    < back       ^ top

    Transferring Files with FTP

    These are the basic steps involved in transferring files with FTP:

    1. Open a session to a remote host with the ftp command.

    2. Enter your account name for the remote system (the account name you normally use to sign on to the remote system), then hit [ENTER].

    3. Enter your remote password (the password you normally use on the remote system).

    4. The default transfer mode is ASCII, which is used for transferring text files. If you are transferring binary files (executable programs, compressed archive files, graphics, etc.), type binary to enter binary transfer mode. Binary mode works for text files as well.

    5. Use the put and get commands (or mput and mget for multiple files) to transfer files to and from the remote system. The put command transfers a file to the remote system. The get command transfers a file from the remote system.

    6. When you have transferred the files you need, use the quit command to close the FTP session.
    < back       ^ top

    A Sample FTP Session

    This is an example of a typical FTP session. The user "godzilla" is performing a file transfer between his local system (nova.umuc.edu) and a remote system (caves.tokyo.org). The lines in bold text show the commands that "godzilla" types to perform his file transfers. The password, which is not visible when you type it, is indicated by asterisks here.

    Nova> ftp caves.tokyo.org
    Connected to caves.tokyo.org
    220 caves FTP Server (Version wu-2.4(1) Sat Apr 16 00:30:53 EDT 1994) ready.
    Name (caves.tokyo.org:godzilla): godzilla
    Password: *******
    230 User godzilla logged in.
    ftp> ls
    caves.list
    tokyo.dreams
    226 Transfer completed
    44 bytes received in 0.0023 seconds (19 kbytes/s)
    ftp> get tokyo.dreams
    200 Port command successful
    150 Opening ASCII mode data connection for tokyo.dreams (10156 bytes).
    226 Transfer complete.
    local: tokyo.dreams remote: tokyo.dreams
    10156 bytes received in 0.018 seconds (5.6e+02 Kbytes/s)
    ftp> quit
    221 Goodbye
    
    < back       ^ top

    Anonymous FTP

    Although FTP may be used to transfer files between private accounts on two different systems, it is more often used by institutions on the Internet to provide files and information for public access. This service is known as anonymous FTP.

    The major difference between standard FTP and anonymous FTP is that with anonymous FTP you do not need to have an account name on the remote system; instead, you use the special account named anonymous. Most anonymous FTP sites request that you use your e-mail address as the password. Once you have signed on to the anonymous FTP site using this special account name/password combination, you will be able to search through the directories there and transfer any files that interest you.

    How do you find out about useful anonymous FTP sites? Informational postings on mailing lists or Usenet news will often include information about FTP sites where you can obtain specific files.

    < back       ^ top
  • © 1996-2007 University of Maryland University College
    3501 University Blvd. East
    Adelphi, Maryland 20783 USA

    Contact Us