File Transfer Protocol (FTP)

Last Edited




FTP stands for File Transfer Protocol is an Internet standard application-level TCP/IP protocol that can be used for transferring files between hosts on a TCP/IP internetwork.

How File Transfer Protocol Works

File Transfer Protocol (FTP) is one of the earliest Internet protocols and is still used for uploading and downloading files between clients and servers.

FTP is built on a client-server model architecture using separate control and data connections between the client and the server. FTP users may authenticate themselves with a clear-text sign-in protocol, normally in the form of a username and password, but can connect anonymously if the server is configured to allow it. For secure transmission that protects the username and password, and encrypts the content, FTP is often secured with SSL/TLS (FTPS) or replaced with SSH File Transfer Protocol (SFTP).

FTP Client

An FTP client is an application that can issue FTP commands to an FTP server, while an FTP server is a service or daemon running on a server that responds to FTP commands from a client. FTP commands can be used to change directories, change transfer modes between binary and ASCII, upload files, and download files.

File Transfer Protocol
File Transfer Protocol

FTP uses Transmission Control Protocol (TCP) for reliable network communication by establishing a session before initiating data transfer. TCP port number 21 on the FTP server listens for connection attempts from an FTP client and is used as a control port for establishing a connection between the client and server, for allowing the client to send an FTP command to the server, and for returning the server’s response to the command.

Once a control connection has been established, the server opens port number 20 to form a new connection with the client for transferring the actual data during uploads and downloads.

What is Anonymous FTP?

A host that provides an FTP service may provide anonymous FTP access. Users typically log into the service with an ‘anonymous’ (lower-case and case-sensitive in some FTP servers) account when prompted for user name. Although users are commonly asked to send their email address instead of a password, no verification is actually performed on the supplied data. Many FTP hosts whose purpose is to provide software updates will allow anonymous logins.

List of FTP Commands (Windows command prompt)

FTP CommandDescription of Command
!This command toggles back and forth between the operating system and ftp. Once back in the operating system, typing exit takes you back to the FTP command line.
?Accesses the Help screen.
appendAppend text to a local file.
asciiSwitch to ASCII transfer mode.
bellTurns bell mode on or off.
binarySwitches to binary transfer mode.
byeExits from FTP.
cdChanges directory.
closeExits from FTP.
deleteDeletes a file.
debugSets debugging on or off.
dirLists files, if connected.
dir -C = lists the files in wide format.
dir -1 = Lists the files in bare format in alphabetic order.
dir -r = Lists directory in reverse alphabetic order.
dir -R = Lists all files in current directory and sub directories.
dir -S = Lists files in bare format in alphabetic order.
disconnectExits from FTP.
getGet file from the remote computer.
globSets globbing on or off. When turned off, the file name in the put and get commands is taken literally, and wildcards will not be looked at.
hashSets hash mark printing on or off. When turned on, for each 1024 bytes of data received, a hash-mark (#) is displayed.
helpAccesses the Help screen and displays information about the command if the command is typed after help.
lcdDisplays local directory if typed alone or if path typed after lcd will change the local directory.
literalSends a literal command to the connected computer with an expected one-line response.
lsLists files of the remotely connected computer.
mdeleteMultiple delete.
mdirLists contents of multiple remote directories.
mgetGet multiple files.
mkdirMake directory.
mlsLists contents of multiple remote directories.
mputSend multiple files.
openOpens address.
promptEnables or disables the prompt.
putSend one file.
pwdPrint working directory.
quitExits from FTP.
quoteSame as the literal command.
recvReceive file.
remotehelpGet help from remote server.
renameRenames a file.
rmdirRemoves a directory on the remote computer.
sendSend single file.
statusShows status of currently enabled and disabled options.
traceToggles packet tracing.
TypeSet file transfer type.
userSend new user information.
verboseSets verbose on or off.

External References: