Many operating systems (UNIX, Linux, Microsoft Windows) are shipped with a built-in FTP Client that is accessed from a command prompt. While graphical FTP clients are easier for beginning users, in the background, they are simply using the same console FTP commands you can use directly from a console style FTP client. While it can take a while to learn the commands, once you do you will find it is often faster to run FTP commands directly from a console client than when using a graphical client.
Getting Started
-
Open a Console Window
To use a console FTP client you will first need access to a command prompt. This can be gained by opening a console window.
-
Windows 9x/2000/NT/ME/XP
Click on Command Prompt, usually found in the Start -> Programs -> Accessories menu. You can also click on Run... in the Start menu and enter command in the dialog box.
-
UNIX and Linux
Because UNIX and Linux are primarily command-line based, you should have no trouble finding a command prompt where you can start a command-line FTP client. For example, when you connect to your Virtual Private Server using SSH or Telnet, you are opening a remote command prompt to your server. This means you can use your Virtual Private Server command prompt to open an FTP connection to another server and download files directly to your Virtual Private Server instead of having to copy them to your local PC and then upload them to your server.
-
-
Connect to a Remote FTP Site
To connect to a remote FTP server from a command-line FTP client, you must start your FTP client program. Usually, you can indicate the site you want to connect to at the same time.
% ftp remote-host.name
The alternative method is to start FTP by simply typing ftp at the command prompt, then at the FTP prompt, use the open command, followed by the domain you want to connect to.
% ftp ftp> open remote-host.name
Once a connection with the remote server is established, you will be prompted to enter a login name and password.
-
Navigate
After you have successfully logged into the remote ftp site, you can navigate around using the cd command to change your current working directory on the remote site. Type ls or dir to list the files in your current working directory on the remote site. You can use the lcd command to navigate around your local filesystem (meaning the machine where the FTP session originated).
-
Upload Files
To upload from your local machine (or the machine from which you initiated the FTP session) to the remote host, you use the command put. For example, to upload a file in your local working directory named index.html to your current working directory on the remote site, you would type put index.html test.html. This will transfer the file index.html to the remote host and store it under the name test.html. If you would like to store the local file as the same name on the remote host simply type something like put index.html index.html or simply put index.html. To upload multiple files, use the command mput using wildcards such as mput *.html. You may want to turn off the confirm prompt by typing the command prompt before you upload multiple files.
-
Download Files
To download content from a remote host (or the machine to which you opened the FTP session) to your local machine, you use the command get. For example, to download a file to your local working directory named test.html from your current working directory on the remote site, you would type get test.html index.html. This will transfer the file test.html from the remote host and store it under the name index.html on your local computer. To download multiple files, use the command mget using wildcards such as mget *.html. You may want to turn off the confirm prompt by typing the command prompt before you download multiple files.
NOTE: Be sure you transfer all text files, such as HTML and Perl CGI scripts, in ASCII format! All image files (.gif, .jpg, etc.) or program files must be transferred in BINARY format.
Commands
Other important FTP commands are summarized in the table below. Arguments for commands are indicated using brackets [ ].
ascii |
Set the file transfer type to network ASCII. |
---|---|
binary |
Set the file transfer type to support binary image transfer. |
bye |
Terminate the FTP session with the remote server and exit ftp. An end of file will also terminate the session and exit. |
cd [remote-directory] |
Change the working directory on the remote machine to remote-directory. |
delete [remote-file] |
Delete the file remote-file on the remote machine. |
dir [remote-directory] |
Print a listing of the directory contents in the directory, remote-directory. If no remote directory is specified, a listing of the current working directory on the remote machine is shown. |
get [remote-file] [local-file] |
Retrieve the remote-file and store it on the local machine. If the local file name is not specified, it is given the same name it has on the remote machine. |
help [command] |
Print an informative message about the meaning of command. If no argument is given, ftp prints a list of the known commands. |
lcd [local-directory] |
Change the working directory on the local machine. If no directory is specified, the user's current local working directory is displayed. |
mdelete [remote-files] |
Delete the remote-files on the remote machine. |
mget [remote-files] |
Download multiple files whose names match remote-files from the remote machine to the local host. Accepts wildcards (e.g. *.html or directory names (download all the contents of the directory specified). |
mkdir [remote-directory] |
Make a directory on the remote machine. |
mput [local-files] |
Upload multiple files from the local host to the remote server. Accepts wildcards and directories. |
prompt |
Toggle interactive prompting. Interactive prompting occurs during multiple file transfers to allow the user to selectively retrieve or store files. If prompting is turned off (default is on), any mget or mput will transfer all files, and any mdelete will delete all files. |
put [local-file] [remote-file] |
Store a local file on the remote machine. If remote-file is left unspecified, the local file name is used. |
rename [from] [to] |
Rename the file from on the remote machine, to the file to. |
rmdir [directory-name] |
Delete a directory on the remote machine. |
Please note: the information on this page applies to ITS web hosting plans. It may or may not apply to other environments. If you are looking for a feature described here, or better support from your hosting provider, please consider hosting your site with ITS!
Copyright © 1996-2024, Integrated Technical Solutions, Inc., all rights reserved. See Terms/Legal for trademarks, copyright, and terms of use.
Naperville, IL 60563
fax 630.420.2771