Topics Map > University of Chicago > IT Services > Applications, Operating Systems, & Devices
Unix - Using FTP
This article explains how to use file transfer protocol in Unix.
Using ftp to transfer your own files
You can use ftp to transfer files from one system where you have an account to another system (where you also have an account). To retrieve (get) files from the Server Cluster while logged into some other machine, ftp to a Cluster machine (such as harper) then use your username (CNetID) and password (instead of "anonymous" and your email address). Then follow the same procedure as above (using the get command, or its variant mget for multiple files). To place (put) files in your home directory on the Server Cluster, use the put or mput commands.
For example, to copy your Statistics homework assignments from the Server Cluster to your own machine, "mycray.rh.uchicago.edu." You would login to the Cluster machine where your home directory is located, then ftp to "mycray.rh.uchicago.edu," and issue the following command:
ftp> mput stat* <Enter>
This would transfer all the files beginning with the pattern "stat" in your home directory to my cray. (The mput and mget commands use the asterisk as a "wildcard"--a letter that can stand for any number of characters.) Once you're finished, use the close and quit commands to end the ftp session.
Ftp command summary
Once you are in ftp, there are only a few basic commands to know:
- changes directory; works like the Unix command (see below)
- lists files, just like the Unix command; all options work (see below)
- lists files; can be more detailed than ls, and often works on systems which do not understand ls
- puts ftp in binary transfer mode; type this before transferring any files which are not strictly ASCII text (such as software, word processing files, sounds, etc.)
- gets a specified file; i.e., copies it from other machine to yours
- multiple get; allows wildcards for matching groups of files
- puts a specified file; i.e., copies it from your machine
- multiple put; allows wildcards for matching groups of files
- disconnects your connection to the remote computer
- ends your ftp session
Although cd and ls usually work just the way they do on the Unix command line, they will behave a bit differently when you ftp to non-Unix systems on the Internet. For example, you may find that ls doesn't accept any of its usual options, or cd will not work with relative pathnames. Most of the time, though, they will work normally.
A note on binary transfer mode
The command summary above mentions that the bin command will invoke "binary transfer mode." By default, ftp transfers files in "ASCII mode," which should be used whenever you use ftp to transfer plain-text files (such as mail messages) across the network. When copying files that are not plain ASCII text, switch to binary mode before making the transfer. This includes executable programs, graphics, compressed or "zipped" file archives, or even Microsoft Word documents (which aren't considered "text" by the computer because of the formatting codes they contain).
Most of the time this distinction is academic, and you can often transfer ASCII files in binary mode without any serious problems. Every now and then, however, you may find yourself trying to retrieve a file from a system with quirks or incompatibilities which will produce gibberish if you use the wrong mode--so it is good to be in the habit of using the right transfer mode whenever you use ftp.
Within ftp on the Server Cluster, typing help in ftp will give you a list of available commands, and helpcommandname will give you help for a particular command.
For more information, see the online manual page: type man ftp at the Unix shell prompt.
Note that software to transfer files using the File Transfer Protocol also exists for several other kinds of machines. One FTP client for the Macintosh is Fetch (included in the Connectivity Package for Macintosh); among the FTP clients for Windows is WS-FTP (included in the Connectivity Package for Windows).