What are the most important FTP commands?
FTP commands can be used to download and upload data. Responses to commands come in the form of status codes.
What are FTP commands and what are they used for?
The File Transfer Protocol (FTP) has been an option for transferring files on the internet since 1971. FTP can be used for downloads and uploads and for regulating the transfer of data between an end device and a server or file server. The network protocol is defined in RFC 959 and operates on the application layer of the OSI model. Special FTP programs like FileZilla can be used to manage uploads and downloads.
Data transfers happen using two channels, the control channel and the data channel. To control the process, FTP commands are exchanged between client and server on TCP port 21.
FTP commands are text based and, in many cases, standardised in RFC 959. They can be used to send, receive, modify, or delete files or directories. While a large number of FTP commands are recognised and used by most programs, there are some commands that are only available for certain clients. This is intended to make clients as user friendly as possible and provide users with better tools. Requests sent by the client with FTP commands are always answered by the server in the form of a status code.
With IONOS’ Cloud Server, you’ll get top-performing infrastructure, scalability and attractive pricing packages. Find the perfect package for your business needs.
What are the essential FTP commands?
As already hinted at above, the list of possible FTP commands is very long. You probably won’t need all of these commands for your day-to-day use of FTP, so we’ll start with the 25 most essential ones. The list below will provide you with a good foundation for setting up your own FTP server. Some of the commands can also be used when working with the Trivial File Transfer Protocol (TFTP).
The 25 most important FTP commands
FTP command | Explanation |
---|---|
ABOR | Aborts previous command |
ACCT | Provides information about an account |
ASCII | Changes from binary mode into ASCII mode; the standard setting without FTP commands is ASCII; binary mode is used for, e.g. images and programs; ASCII mode is used for text documents |
BINARY | Changes from ASCII mode into binary mode |
CD | Changes to the next-highest level (CD stands for ‘change directory’) |
CDUP | Automatically changes to the parent directory |
CWD | Changes the working directory |
DELE | Deletes a file |
FEAT | Lists all the server’s features |
GET | Requests a file that’s on the server (file name follows command) |
HELP | Lists all FTP commands that are used by the server |
MKD | Creates new directory |
PASS | Enters the password for access to a server |
PASV | Changes to a passive FTP connection |
PORT | Transfers the address of the FTP ports that server should use |
PUT | Sends a local file to the FTP server (file name follows the command) |
QUIT | Terminates the connection between client and server |
REST | Restarts a stopped or stalled transfer from a specified point |
RMD | Removes the specified directory |
SIZE | Returns the size of a file |
STAT | Provides information about the status of a server and the current connection |
STOR | Copies a file from the server |
SYST | Shows which operating system is installed on the server |
TYPE | Defines the transfer mode (binary or ASCII) |
USER | Changes the user that is accessing the server (and then requests password) |
The FTP commands and their RFCs
Below we list the 25 most important FTP commands and their Requests for Commands (RFCs):
FTP command | Request for Commands (RFC) |
---|---|
ABOR | RFC 959 |
ACCT | RFC 959 |
ASCII | RFC 959 |
BINARY | RFC 959 |
CD | RFC 959 |
CDUP | RFC 959 |
CWD | RFC 697 |
DELE | RFC 959 |
FEAT | RFC 2389 |
GET | RFC 959 |
HELP | RFC 959 |
MKD | RFC 959 |
PASS | RFC 959 |
PASV | RFC 959 |
PORT | RFC 959 |
PUT | RFC 959 |
QUIT | RFC 959 |
REST | RFC 3659 |
RMD | RFC 959 |
SIZE | RFC 3659 |
STAT | RFC 959 |
STOR | RFC 959 |
SYST | RFC 959 |
TYPE | RFC 959 |
USER | RFC 959 |
Web hosting packages from IONOS include SSL, DDoS protection and backups. Take advantage of our scalable offer and stay flexible. Get hosting and a domain, just how you want it!
What FTP commands exist for Linux?
FTP commands can also be used in Linux. For example, you can set up a Ubuntu FTP server, create your own Debian FTP server or access Linux from your client. There are also a number of FTP commands specific to Linux, which can be entered directly into the command line. Here are just a few:
- -4: uses only IPv4 to contact a host
- -6: uses only IPv6
- -d: gives permission for debugging
- -e: disables command editing and history support
- -g: prevents the use of placeholder names (globbing) for files
- -i: turns off interactive prompting during multiple file transfers
- -n: prevents automatic login attempts
- -p: changes transfer into passive mode
- -v: gets all responses from server, including transfer statistics
What status codes are there?
When you send FTP commands, the server answers with a status code, which is made up of a three-digit number and sent in the form of an HTTP response. Status codes are divided up into five categories:
- 100–199: these codes indicate that the FTP command was more or less successful. The server then requests another command.
- 200–299: these codes also indicate that your FTP command was successful. Further commands aren’t required.
- 300–399: these codes also communicate that your FTP command was successful. In order to thoroughly complete the operation, further information is needed.
- 400–499: if you get one of these codes as an answer, your command wasn’t executed. The problem is likely temporary, and if you enter the command again you might get a better result.
- 500–599: these codes indicate that the command wasn’t executed, and that if you try again, you’ll get the same error message.
Summary: best practices for working with FTP commands
You can use the FTP commands listed above to transfer data and make changes to your own website. However, since usernames and passwords aren’t encrypted in FTP, you should consider using SSH File Transfer Protocols (SFTP) instead. It’s based on FTP but offers significantly better security. You should also consider doing a port test in advance.
For a secure solution, rent a SFTP server from IONOS and benefit from daily automatic backups and flexible pricing packages for Windows and Linux hosting.