Essential FTP Commands: A Complete Reference
FTP has been around for 50+ years and the command vocabulary is well-established. This is the complete reference — the essential CLI commands you'll use daily, the protocol-level verbs the wire format uses, and the differences when you switch to SFTP.
If you're using the command-line ftp client (or the equivalent on Windows), the command set is small enough to learn in an afternoon. The protocol-level command list — the wire-format verbs an FTP server understands — is much longer. This post covers both: the dozen-or-so CLI commands you'll actually use daily at the top, followed by the complete protocol-level reference grouped by category. Plus the differences when you switch to SFTP, common recipes, and a downloadable cheat sheet.
Download the printable FTP commands cheat sheet (PDF) — one-page reference for your monitor.
The essential FTP CLI commands
These are the commands you'll type into the ftp> prompt of any standard FTP client. Learn these and you can do 95% of FTP work.
| Command | What it does |
|---|---|
open <host> | Connect to an FTP server |
user <name> | Send your username |
pass <password> | Send your password |
pwd | Print working directory (where you are on the server) |
cd <dir> | Change directory on the server |
lcd <dir> | Change directory on your local machine |
ls (or dir) | List files in the current remote directory |
get <file> | Download a file from the server |
put <file> | Upload a file to the server |
mget <pattern> | Download multiple files (e.g., mget *.csv) |
mput <pattern> | Upload multiple files |
mkdir <dir> | Create a directory on the server |
rmdir <dir> | Remove an empty directory on the server |
delete <file> | Delete a file on the server |
rename <old> <new> | Rename a file |
binary | Switch to binary transfer mode (default for non-text) |
ascii | Switch to ASCII transfer mode (text with line-ending translation) |
passive | Toggle passive mode on/off |
quit (or bye) | Disconnect and exit |
A typical session looks like:
$ ftp ftp.example.com
Name: alice
Password: ********
230 Login successful
ftp> cd /reports
ftp> ls
ftp> get may.csv
ftp> put forecast.xlsx
ftp> quit
That's the whole job for most FTP work.
The full protocol-level command reference
The commands above are CLI niceties; underneath, the FTP client translates them into protocol-level verbs the server understands. These are what you'll see in protocol logs, packet captures, and the Telnet walkthroughs people use to debug FTP.
Connection and authentication
| Command | Description |
|---|---|
USER | Send the authentication username |
PASS | Send the authentication password |
ACCT | Send account information (rare, mainly mainframe-era) |
REIN | Reinitialize the connection (log out, stay connected) |
QUIT | End the session |
AUTH | Negotiate security mechanism (used by FTPS for TLS upgrade) |
ADAT | Authentication / security data |
CCC | Clear command channel (post-auth, return to cleartext for control) |
CONF | Confidentiality protection command |
ENC | Privacy-protected channel |
MIC | Integrity protection channel |
PBSZ | Protection buffer size |
PROT | Data channel protection level (C clear, P private) |
Navigation
| Command | Description |
|---|---|
CWD | Change working directory |
CDUP | Change to parent directory |
PWD | Print working directory |
SMNT | Mount different file structure (legacy, rare) |
XCUP | Change to parent (deprecated synonym for CDUP) |
XPWD | Print working directory (deprecated synonym for PWD) |
Listing
| Command | Description |
|---|---|
LIST | List directory contents in human-readable format (ls -l style) |
NLST | Name list — bare filenames only |
MLSD | Machine-readable directory listing (modern replacement for LIST) |
MLST | Machine-readable single-object info |
STAT | Return server status (or, with a path, info about a path) |
MDTM | Return last-modified time of a file |
SIZE | Return file size in bytes |
MFMT | Modify file's last-modified time |
MFCT | Modify file's creation time |
MFF | Modify file fact (generic) |
DSIZ | Return directory size |
AVBL | Return available space at a path |
Transfer
| Command | Description |
|---|---|
RETR | Retrieve (download) a file from the server |
STOR | Store (upload) a file to the server |
STOU | Store unique (upload with auto-generated unique name) |
APPE | Append to a file (or create if missing) |
REST | Restart point — resume a transfer at a specific offset |
ABOR | Abort the current transfer |
ALLO | Allocate disk space for an incoming file |
TYPE | Set transfer type (A ASCII, I Image/binary) |
MODE | Set transfer mode (Stream / Block / Compressed) |
STRU | Set file structure (File / Record / Page) |
Data-connection setup
| Command | Description |
|---|---|
PORT | Active mode — tell the server which client port to connect to |
PASV | Request passive mode — server opens a listening port |
EPRT | Extended PORT (supports IPv6) |
EPSV | Extended PASV (supports IPv6) |
LPRT | Long PORT (deprecated, replaced by EPRT) |
LPSV | Long PASV (deprecated, replaced by EPSV) |
SPSV | Single-port passive mode |
See our active vs passive FTP explainer for the practical implications.
File and directory management
| Command | Description |
|---|---|
DELE | Delete a file |
RMD | Remove an empty directory |
RMDA | Remove a directory tree (recursive — uncommon) |
MKD | Make a directory |
RNFR | Rename from (paired with RNTO) |
RNTO | Rename to (must follow RNFR) |
XRMD | Remove directory (deprecated synonym for RMD) |
XMKD | Make directory (deprecated synonym for MKD) |
XRCP | Remote copy (rarely implemented) |
Server information and miscellaneous
| Command | Description |
|---|---|
SYST | Return the server's operating system identifier |
HELP | List available commands (or, with an argument, help for one command) |
NOOP | No-op — used for keepalive |
FEAT | List protocol features the server supports |
OPTS | Set options for a feature (e.g., OPTS UTF8 ON) |
HOST | Identify the desired virtual host on a multi-host server |
LANG | Set the language for server response messages |
CSID | Client / server identification (rare) |
THMB | Request a thumbnail of a remote image (rare) |
SITE | Send site-specific commands (server-specific extension) |
How CLI commands map to protocol commands
The CLI command and the protocol command don't always match name-for-name. A few of the common mappings:
| CLI command | Protocol verb |
|---|---|
get | RETR |
put | STOR |
ls | NLST or LIST |
dir | LIST |
mkdir | MKD |
rmdir | RMD |
delete | DELE |
cd | CWD |
pwd | PWD |
binary | TYPE I |
ascii | TYPE A |
passive | (toggle — affects PASV vs PORT for next transfer) |
bye / quit | QUIT |
If you're debugging an FTP problem with packet captures or server logs, this is the translation table you need.
What changes when you use SFTP
SFTP shares the broad shape of FTP's command set but uses its own wire protocol (SSH file-transfer subsystem), not the FTP command verbs. The CLI commands look similar:
| CLI command | Works in FTP | Works in SFTP |
|---|---|---|
cd, ls, pwd, mkdir, rmdir, mget, mput, bye, quit | Yes | Yes |
get, put | Yes | Yes |
delete | Yes | No — use rm |
rename | Yes | Yes (rename <old> <new>) |
binary, ascii | Yes | No — SFTP is binary-only |
open, close | Yes | No — connection model is different |
passive | Yes | No — SFTP doesn't have active/passive |
reget, reput | No | Yes (resume support is native) |
chmod, chown | No (no Unix-permission semantics in FTP) | Yes |
ln, symlink | No | Yes |
SFTP gains the Unix-permission commands (chmod, chown, ln) because the protocol carries Unix-style file metadata; FTP doesn't standardize that. SFTP loses the transfer-mode flags (binary / ascii) because everything is binary by definition — line-ending translation is the application's responsibility.
Common recipes
Upload a single file in one shell command
echo "put forecast.xlsx /reports/" | ftp -n ftp.example.com <<EOF
user alice s3cret
binary
put forecast.xlsx /reports/forecast.xlsx
bye
EOF
This is the canonical "send a file from a cron job" pattern. For real automation, use curl --upload-file or a real library — ftp-via-heredoc is fragile.
Download a whole directory
ftp> cd /reports
ftp> binary
ftp> prompt off
ftp> mget *
prompt off suppresses the per-file confirmation; otherwise mget * asks you to confirm each download.
Resume an interrupted transfer
ftp> rest 1048576
ftp> get bigfile.iso
REST sets a restart point in bytes. Combined with get, the transfer resumes from byte 1048576 — useful if your previous transfer died and you want to skip the bytes you already have. SFTP's reget does the same thing automatically.
Show recent server activity from the CLI
ftp> stat
STAT returns the server's current state plus any session-level information it tracks. Useful for debugging stuck transfers.
Modern alternatives to typing FTP commands
For interactive use, graphical clients (FileZilla, Cyberduck, WinSCP) abstract these commands behind drag-and-drop — see our FileZilla alternatives roundup. For automation, the canonical paths are:
- Python —
ftplib(FTP / FTPS) orparamiko(SFTP). - Node.js —
basic-ftpfor FTP,ssh2for SFTP. - curl / wget — for one-off shell scripts,
curl --upload-fileandcurl -Oare cleaner than driving theftpCLI. - REST APIs — Files.com's REST API lets automation skip FTP entirely; SDKs in 8 languages.
For partner-facing FTP endpoints in 2026, Files.com is the File Orchestration Platform we'd recommend — your partners type the same commands at the FTP / SFTP prompt; the server side is fully managed (TLS, audit logging, MFA, key management, SOC 2). Free trial — provisioned in about 10 minutes.
For the narrow set of teams that must run file-transfer infrastructure inside their own datacenter, the free ExaVault on-premise appliance handles the same protocols from a self-hosted VM image.
FAQ
What's the most-used FTP command?
Probably get (download) and put (upload), followed by ls (list files) and cd (change directory). The full daily-use set is about a dozen commands; the rest of the protocol command list shows up mostly during debugging or for specialized features.
What's the difference between ls and dir in FTP?
In the standard FTP CLI, both list directory contents — dir is an alias for ls (or vice versa, depending on the client). At the protocol level, LIST returns a long-form listing (ls -l style) and NLST returns bare filenames only. The CLI's ls often calls NLST; dir often calls LIST. Behavior varies between clients.
What's the FTP command to resume a transfer?
REST <offset> followed by RETR <file> (for download) or STOR <file> (for upload). The CLI doesn't usually expose REST directly; most clients implement resume as an option in their UI. For automation, curl --continue-at - handles resume automatically.
How do I list files in FTP?
At the ftp> prompt, type ls or dir. To list a specific directory, use ls /path/to/directory. To get a machine-readable listing, the server-side MLSD command (if the server supports it) returns a standardized format that's easier to parse than the human-readable output.
What does pwd do in FTP?
pwd prints the current working directory on the remote server. Useful for figuring out where you are after a series of cd commands. The local equivalent in the FTP CLI is lpwd (some clients) or !pwd (others, which runs pwd in the local shell).
Can I script FTP commands?
Yes. The standard ftp CLI supports -n (no auto-login) plus reading commands from stdin, which lets you script with a heredoc (see the recipe above). For anything more complex, use a real library — lftp is a scriptable CLI with proper command syntax and error handling, or move up to a language binding like ftplib (Python) or basic-ftp (Node.js).
What's the FTP command for SFTP?
SFTP isn't FTP — it's an SSH subsystem, not the same protocol. The CLI commands are similar (get, put, cd, ls) but the wire-protocol verbs are entirely different. See our SFTP explainer for the underlying differences.