File Transfer Protocol (FTP) (original) (raw)

Last Updated : 9 Dec, 2025

File transfer protocol (FTP) is an Internet tool provided by TCP/IP. It helps to transfer files from one computer to another by providing access to directories or folders on remote computers and allows software, data and text files to be transferred between different kinds of computers.

**Note: The end-user in the connection is known as localhost and the server which provides data is known as the remote host.

Applications of FTP

FTP Client and Server Model

FTP follows a client-server architecture.

Commands

**Note: Many modern operating systems have built-in FTP programs, making file transfer easier without needing to memorize commands.

Types of FTP Connections

FTP connections are of two types:

active_ftp_connection

FTP Connections

1. Active FTP connection

2. Passive FTP connection

Anonymous FTP

Some servers provide anonymous FTP, where files are available for public access without authentication.

How FTP works?

When an FTP connection is established, two parallel channels are created:

  1. **Command Channel: Used for transmitting commands (like login, navigation and file requests). Operates over Port 21.
  2. **Data Channel: Used for transferring the actual data/files. Operates over Port 20.

ftp_client

How FTP Works?

Detail Steps of FTP

**Note: FTP uses the NVT ASCII character set for communication over the control channel, similar to TELNET and SMTP.

Transmission Mode

FTP supports three transmission modes:

  1. **Stream Mode: (Default) Data is sent as a continuous stream of bytes. TCP handles fragmentation. Connection closes automatically at the end of transmission.
  2. **Block Mode: Data is sent in blocks, each with a 3-byte header describing the block. Useful for structured data.
  3. **Compressed Mode: Large files are compressed before transfer to save bandwidth and speed up transmission.

FTP Commands

Command Meaning
cd Change working directory on the remote host.
close Close the FTP connection.
quit Exit the FTP session.
pwd Show current working directory on remote host.
dir/ls List files in the current directory.
help Display list of client FTP commands.
remotehelp Display list of server FTP commands.
type Specify file type (ASCII/Binary).
struct Specify file structure.

Why FTP?

While other protocols like HTTP can also transfer files, FTP provides a more specialized, reliable and standardized way to handle file exchanges between heterogeneous systems.

FTP supports transferring:

**Note: It ensures compatibility between different operating systems, file structures and character sets.