All Essential FTP Commands List

by on September 14th, 2009

Besides using your favorite FTP manager in its graphical user interface, you can also give it instructions using commands. The benefit of these commands is that you have more control over your FTP program. All the controls for tasks which FTP can perform are not always present in its GUI. There is more you can do using these commands. Commands which begin with the letter X are generally reserved for experimental extensions. In every FTP software there is an option to run custom command or raw command. There are several commands for FTP. Infact here is a complete list of FTP commands you can use with your FTP software.

RAW FTP Commands List
  • ABOR – abort a file transfer
  • CWD – change working directory
  • DELE – delete a remote file
  • LIST – list remote files
  • MDTM – return the modification time of a file
  • MKD – make a remote directory
  • NLST – name list of remote directory
  • PASS – send password
  • PASV – enter passive mode
  • PORT – open a data port
  • PWD – print working directory
  • QUIT – terminate the connection
  • RETR – retrieve a remote file
  • RMD – remove a remote directory
  • RNFR – rename from
  • RNTO – rename to
  • SITE – site-specific commands
  • SIZE – return the size of a file
  • STOR – store a file on the remote host
  • TYPE – set transfer type
  • USER – send username
  • ACCT – send account information
  • APPE – append to a remote file
  • CDUP – CWD to the parent of the current directory
  • HELP – return help on using the server
  • MODE – set transfer mode
  • NOOP – do nothing
  • REIN – reinitialize the connection
  • STAT – return server status
  • STOU – store a file uniquely
  • STRU – set file transfer structure
  • SYST – return system type
FTP Commands

RFC959 defines the following FTP commands, which were also present in RFC765:

  • USER: supplies the username for login
  • PASS: supplies the password for login
  • ACCT: supplies accounting information. For example, a user may work on multiple projects; the account can be used to ensure that the charges for the data storage are billed to the correct project. (Not commonly implemented).
  • CWD: changes the working directory to that specified
  • REIN: removes all authentication information and parameter settings; must be followed by relogin via USER
  • QUIT: terminates the connection
  • PORT: host/port specification for data transfer
  • PASV: enter passive mode
  • TYPE: specify data type and vertical format control (see above)
  • STRU: specify data structure (see above)
  • MODE: specify transmission mode (see above)
  • RETR: initiates a data transfer from server to client, specifying name of file to retrieve
  • STOR: initiates a data transfer from client to server, specifying name file is to be stored in on server
  • APPE: similar to STOR, except if file already exists, append received data to end of it rather than create
  • ALLO: allocates space for a file. Optionally, specifies the maximum size of each record.
  • REST: specifies the restart marker from which the transfer is to resume. Originally intended for use with restart markers sent by the server in B or C mode, but later extended in RFC3659 to byte offsets specified in S mode.
  • RNFR: to rename a file, specify the file to be renamed
  • RNTO: to rename a file, specifies the new name for the file, and performs the rename. Often also used to implement moves.
  • DELE: deletes a file
  • PWD: prints the current working directory
  • LIST: opens a data connection with A or E data type, to transfer a listing of files in the current directory. The format of data is system-specific, but intended to be human readable.
  • NLST: similar to LIST, but transfer unadorned names of files with CRLF or NL.
  • SITE: provides subcommands to perform system specific services. The nature of these services is undefined.
  • STAT: without arguments, current status of connection. With argument, equivalent to LIST, but the listing is transferred over the control connection encapsulated in messages.
  • HELP: provides HELP, optionally with an argument to specify the specific command on which help is requested.
  • NOOP: does nothing

RFC959 adds the following new commands which were not present in RFC765:

  • CDUP: changes the working directory to the parent. Present since the notation for parent directory varies from platform to platform (although most commonly .. on systems descended from Unix or MS DOS).
  • SMNT: mount a different file system or volume. Intended for systems such as DOS or VMS where there is a distinction between volume and directory in pathnames; but commonly unimplemented even on such systems.
  • STOU: store unique – initiates a data transfer from client to server; server shall chose a unique name for file to be received
  • RMD: removes a directory
  • MKD: creates a directory
  • PWD: prints the current directory
  • SYST: identifies the operating system of the server

RFC765 described a number of commands which were removed in RFC959. These have not been part of FTP implementations since the early 1980s, since their functionality was later replaced (in part) by SMTP:

  • MLFL: used to send email over the data connection
  • MAIL: used to send email over the control connection
  • MSND: like MAIL, but sends data directly to user’s terminal rather than their mailbox
  • MSOM: behaves as either MAIL or MSND—send to terminal if allowed, otherwise to mailbox
  • MSAM: similar to MSOM—except that MSOM only sends to mailbox if delivery to terminal not possible; but MSAM sends to mailbox irrespective of whether terminal delivery is successfully attempted
  • MRSQ: enables transmission of a single email to multiple users at the same host
  • MRCP: subsequent to MRSQ, identifies one such recipient; repeated for each recipient

RFC2228 adds a number of commands related to encryption and message authentication:

  • AUTH: identifies the authentication/security mechanism to be used
  • ADAT: specifies security data specific to the chosen AUTH mechanism
  • PBSZ: used to negotiate maximum buffer size for encrypted data
  • PROT: specifies protection level for data channel. Following levels are defined:
    • C (Clear) – data channel is subject neither to encryption nor integrity protection
    • S (Safe) – integrity protection applied to data channel
    • E (Confidential) – encryption applied to data channel
    • P (Private) – both encryption and integrity protection applied to data channel
  • CCC: disables integrity protection for subsequent commands on control channel
  • MIC: sends a command with integrity protection
  • CONF: sends a command with confidentiality protection
  • ENC: sends a command with both integrity and confidentiality protection

RFC1639 ("FOOBAR"; succeeded RFC1545) adds support for FTP over arbitrary transport protocols, such as IPX/SPX or OSI. For this, it defines two new commands:

  • LPRT: similar to PORT, but supports arbitrary address and port formats.
  • LPSV: similar extension to PASV

RFC2389 defines two new commands used as a generic extension mechanism for FTP:

  • FEAT: retrieves a listing of optional features supported by FTP server
  • OPTS: a generic mechanism for the client to specify options to arbitrary FTP commands

RFC2428 adds two new commands, similar in principle to RFC1639 but differing in details:

  • EPRT: similar to PORT, but supports arbitrary address families rather than only IPv4; specifically intended for IPv6.
  • EPSV: similar extension to PASV

LPRT sends addresses as an arbitrary octet string (albeit decimal encoded), EPRT sends them as formatted strings, the format of the string being dependent upon the address format. EPRT assumes a the use of TCP-style 16-bit port numbers, whereas LPRT is more flexible and supports transport protocols with greater than 16-bit port numbers.

RFC2640 adds one new command:

  • LANG: used to choose the language for FTP messages

RFC3659 defines several new commands:

  • MDTM: retrieve file modification time
  • SIZE: retrieve file size
  • MLSD: retrieve listing of files in a directory. Unlike NLST, this returns not only file names but also attributes; but unlike LIST, it returns the attributes in an extensible standardised format rather than an arbitrary platform-specific one.
  • MLST: same as MLSD, but retrieves listing for an individual file rather than a directory. For directories, retrieves their own attributes rather than a listing of their members. MLST does not require a data connection, but returns a single line containing the listing for the requested path.

Share