Berikut perintah yang ada dalam FTP
- 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
Less common commands
- 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
ABORAborts a file transfer currently in progress.
ACCT account-infoThis command is used to send account information on systems that require it. Typically sent after a PASS command.
ALLO size [R max-record-size]Allocates sufficient storage space to receive a file. If the maximum size of a record also needs to be known, that is sent as a second numeric parameter following a space, the capital letter “R”, and another space.
APPE remote-filenameAppend data to the end of a file on the remote host. If the file does not already exist, it is created. This command must be preceded by a PORT or PASV command so that the server knows where to receive data from.
CDUPMakes the parent of the current directory be the current directory.
CWD remote-directoryMakes the given directory be the current directory on the remote host.
DELE remote-filenameDeletes the given file on the remote host.
HELP [command]If a command is given, returns help on that command; otherwise, returns general help for the FTP server (usually a list of supported commands).
LIST [remote-filespec]If remote-filespec refers to a file, sends information about that file. If remote-filespec refers to a directory, sends information about each file in that directory. remote-filespec defaults to the current directory. This command must be preceded by a PORT or PASV command.
MDTM remote-filenameReturns the last-modified time of the given file on the remote host in the format ”
YYYYis the four-digit year,
MMis the month from 01 to 12,
DDis the day of the month from 01 to 31,
hhis the hour from 00 to 23,
mmis the minute from 00 to 59, and
ssis the second from 00 to 59.
MKD remote-directoryCreates the named directory on the remote host.
MODE mode-characterSets the transfer mode to one of:
- S – Stream
- B – Block
- C – Compressed
The default mode is Stream.
NOOPDoes nothing except return a response.
PASVTells the server to enter “passive mode”. In passive mode, the server will wait for the client to establish a connection with it rather than attempting to connect to a client-specified port. The server will respond with the address of the port it is listening on, with a message like:
227 Entering Passive Mode (a1,a2,a3,a4,p1,p2)where a1.a2.a3.a4 is the IP address and p1*256+p2 is the port number.
PORT a1,a2,a3,a4,p1,p2Specifies the host and port to which the server should connect for the next file transfer. This is interpreted as IP address a1.a2.a3.a4, port p1*256+p2.
PWDReturns the name of the current directory on the remote host.
QUITTerminates the command connection.
REINReinitializes the command connection – cancels the current user/password/account information. Should be followed by a USER command for another login.
REST positionSets the point at which a file transfer should start; useful for resuming interrupted transfers. For nonstructured files, this is simply a decimal number. This command must immediately precede a data transfer command (RETR or STOR only); i.e. it must come after any PORT or PASV command.
RMD remote-directoryDeletes the named directory on the remote host.
RNFR from-filenameUsed when renaming a file. Use this command to specify the file to be renamed; follow it with an RNTO command to specify the new name for the file.
RNTO to-filenameUsed when renaming a file. After sending an RNFR command to specify the file to rename, send this command to specify the new name for the file.
SITE site-specific-commandExecutes a site-specific command.
SIZE remote-filenameReturns the size of the remote file as a decimal number.
STAT [remote-filespec]If invoked without parameters, returns general status information about the FTP server process. If a parameter is given, acts like the LIST command, except that data is sent over the control connection (no PORT or PASV command is required).
STOUBegins transmission of a file to the remote site; the remote filename will be unique in the current directory. The response from the server will include the filename.
STRU structure-characterSets the file structure for transfer to one of:
- F – File (no structure)
- R – Record structure
- P – Page structure
The default structure is File.
SYSTReturns a word identifying the system, the word “Type:”, and the default transfer type (as would be set by the TYPEcommand). For example:
TYPE type-character [second-type-character]Sets the type of file to be transferred. type-character can be any of:
- A – ASCII text
- E – EBCDIC text
- I – image (binary data)
- L – local format
For A and E, the second-type-characterspecifies how the text should be interpreted. It can be:
- N – Non-print (not destined for printing). This is the default if second-type-character is omitted.
- T – Telnet format control (
- C – ASA Carriage Control
For L, the second-type-characterspecifies the number of bits per byte on the local system, and may not be omitted.
USER usernameSend this command to begin the login process. username should be a valid username on the system, or “anonymous” to initiate an anonymous login.