To connect to and use FTP from a command line interface, like MS-DOS or the Linux shell, click a link below for instructions.

Connect using FTP

To connect to another computer using FTP at the MS-DOS prompt, command line, or Linux shell, type FTP, and press Enter. Once in FTP, use the open command to connect to the FTP server, as shown in the following example.

FTP is not an encrypted transmission, which means any data sent over it, including your username and password, could be read by anyone intercepting your transmission. If you want a more secure transmission, we suggest using SFTP.

  • Connect using FTP.
  • Send and receive a file in FTP.
  • FTP commands.

open ftp.example.com

In the example above, you’d substitute example.com for the domain name or IP address of where you are connecting. An example would be open 192.168.1.12.

Once connected, a username and password prompt appears. Once these credentials are entered, the server lets you browse, send, or receive files, depending on your rights. Some servers may also allow anonymous logins using guest or an e-mail address.

By default, the open command uses the TCP port 21 to make the FTP connection. If a different TCP port is needed to connect, enter the port number after the domain name or IP address in the open command.

Send and receive a file in FTP

To get files from the server onto your computer, use the get command, as shown in the following example. In this example, you would get the file myfile.htm.

get myfile.htm

Use the send command, as shown in the following example, to move a file to another connected computer. In this example, we are sending the myfile.htm to the current directory.

If you want to get more than one file, use mget and wildcards. For example, if you wanted to get all files that end with .htm, you could type mget *.htm. Finally, if you do not want to be prompted as each file is sent, make sure to type prompt to disable prompting.

send myfile.htm

It is important to realize that the files sent must be in your local working directory. In other words, the directory you were in when you typed the FTP command. If you want to change to the local directory containing your files, use the lcd command. For example, in Windows, you’d type lcd c:\windows to set the local directory to the Windows directory.

FTP commands

Depending on the version of FTP and the operating system, each of the following commands may or may not work. Typing -help or a ? lists the commands available to you. Below is a general description of FTP commands available in the Windows command line FTP command.

  • Linux and Unix FTP command help and information.
  • See FTP definition for additional information and related links.
  • FTP help and support.