Command Line FTP

Why use Command-Line FTP?

Command line FTP allows you to transfer files between the tdl server and a remote server via the Internet backbone at T1/T3 speeds. This means that the transfer will take place very quickly, and will not use your modem connection at all. One example of use would be transferring images from a remote clip art ftp area to your account for use on your home page.

FTP Commands

Logging in, Logging Out
Command Function
ftp Opens an ftp session from your shell account to a remote server. You must first log into your shell account.
Example: ftp servername
You will be prompted for your user name and password.
bye Closes your ftp session with the remote server.
You will return to your regular shell prompt after closing your ftp session.

When transferring files, it is very important to make sure you are in the correct mode.
ascii This is the default mode, and this is to be used when transferring text files.
Example: ascii
bin This mode must be used when transfering graphics (jpg, gif files.
Example bin

Listings and Directory Changing
Command Function
ls Lists the current directory contents
Example: ls
cd Performs the same function as clicking an icon in MAC/Windows or cd in DOS -- it changes directories. Alternating cdls, you can find your way down the directory tree of the remote host to the files you are looking for.
Example: cd subdirectory
cd .. Backs you up one directory level (to the parent directory). Otherwise, the syntax is cd [directoryname]. It is helpful to visualize the tree structure of a directory while you are exploring a remote server using ls and cd.
Example: cd ..
lcd Changes your local working directory -- where you are on the machine you are ftp'ing from. This is where files will be put from, and where get will deposit them.
Example lcd subdirectory
lcd .. Backs you up one directory level (to the parent directory) of your local working directory much like cd .. backs you up one directory level on the remote machine.
Example: lcd ..
mkdir Makes a directory on the remote server.
Example: mkdir [newdirectoryname]

Transferring Files
You can transfer one file at a time (by naming the file) or many with the use of the * character.
Command Function
put Puts one file to the remote location
Example: put filename.ext
mput Puts multiple files to the remote location
Example: mput * to put all files in your local current directory to the remote directory)
or mput *.html to put all .html files
or *.jpg to put all jpg images
or *.gif to put all gif images
get Gets a single file.
Example: get filename.ext
mget Gets multiple files. You can use the * as you did with the mput command.
Example: mget *
or mget *.html to get all .html files
or *.jpg to get all jpg images
or *.gif to get all gif images
del Deletes a file or directory.
Example: del filename - deletes a specific file
del * - deletes all files and directories*
del *.html - deletes all html files
del *.jpg - deletes all jpg files
del *.gif - deletes all gif files
del directoryname - to delete a specific directory*
*Note: A directory cannot be deleted unless it is empty.
prompt When you begin a file transfer, by default, you are prompted to confirm the transfer of each and every file. You can turn this off by typing prompt which toggles this feature off. (Typing prompt again turns it back on). This is especially useful when transferring multiple files and want them to go all at once without asking you to confirm each and every one.
Example: prompt
hash The hash command is the equivalent of a status bar in the Windows O/S. hash lets you know the progress of your file transfer if you turn it on. For example, if you are transferring a 200 meg file and you do not have hash toggled on, you have no indication as to whether or not it is transferring.

Since hash slows the ftp process, a general rule of thumb is that if you are transferring large files, turn hash on so you can make sure the files are transferring. If you have many small files to transfer, turn it off.

Example: hash

Return to support index.

Return to shell4 home.