Use FTP From Command Line

FTP (File Transfer Protocol) is a network protocol to transfer files from one computer to another, server and a client. The default port number designated to FTP protocol is 21. The port for secure FTP (sFTP) is 22. In this article we will discuss about using FTP from command line to transfer files quickly without downloading any software.

Sometimes we are in a hurry and we want to instantly transfer one file from one computer to another. If the target computer has a FTP server installed in it, we can easily transfer the file using FTP protocol.

Windows ftp client

Using Windows built-in FTP

Windows comes with a built-in command line FTP client. You can run the FTP client through command prompt. To start the FTP client, go to cmd and issue the “ftp” command. This will change the prompt to ftp>. Now you can issue FTP commands and type ‘quit’ when done.

To connect to the server, run the following command:

ftp hostname

You can also use command line switches with this command. It supports the following switches:

-v Suppresses display of remote server responses.

-n Suppresses auto-login upon initial connection.

-i Turns off interactive prompting during multiple file transfers.

-d Enables debugging.

-g Disables filename globbing

-s:filename Specifies a text file containing FTP commands; the commands will automatically run after FTP starts.

-a Use any local interface when binding data connection.

-A login as anonymous.

-x:send sockbuf Overrides the default SO_SNDBUF size of 8192.

-r:recv sockbuf Overrides the default SO_RCVBUF size of 8192.

-b:async count Overrides the default async count of 3

-w:windowsize Overrides the default transfer buffer size of 65535.

All these commands can be displayed by using /? operator along with the ftp command.

Now let’s take an example of how to transfer a file using this FTP command line utility. Here are the commands:

To transfer from client to server:

Single file:

ftp> put local_file remote_file

Multiple files:

ftp> mput local_files

To transfer from server to client:

Single file:

ftp> get remote_file local_file

Multiple files:

ftp> mget remote_files

To delete a file from the FTP server:

Single file:

ftp> delete remote_file

Multiple files:

ftp> mdelete remote_files

Here’s a video which tells us about using FTP from Windows Explorer (although using Windows XP, it’s good for Windows 7 and Windows 8 too).


These are the basic commands that you can use to run the FTP client from command line. If you are a GUI lover, you can use FileZilla for transferring files visually. FileZilla also comes with a handy list of command line arguments but in my opinion FileZilla’s command line options are fairly limited.