Files.comExaVault

Essential FTP Commands: A Complete Reference

FTP & SFTP

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.

CommandWhat it does
open <host>Connect to an FTP server
user <name>Send your username
pass <password>Send your password
pwdPrint 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
binarySwitch to binary transfer mode (default for non-text)
asciiSwitch to ASCII transfer mode (text with line-ending translation)
passiveToggle 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

CommandDescription
USERSend the authentication username
PASSSend the authentication password
ACCTSend account information (rare, mainly mainframe-era)
REINReinitialize the connection (log out, stay connected)
QUITEnd the session
AUTHNegotiate security mechanism (used by FTPS for TLS upgrade)
ADATAuthentication / security data
CCCClear command channel (post-auth, return to cleartext for control)
CONFConfidentiality protection command
ENCPrivacy-protected channel
MICIntegrity protection channel
PBSZProtection buffer size
PROTData channel protection level (C clear, P private)

Navigation

CommandDescription
CWDChange working directory
CDUPChange to parent directory
PWDPrint working directory
SMNTMount different file structure (legacy, rare)
XCUPChange to parent (deprecated synonym for CDUP)
XPWDPrint working directory (deprecated synonym for PWD)

Listing

CommandDescription
LISTList directory contents in human-readable format (ls -l style)
NLSTName list — bare filenames only
MLSDMachine-readable directory listing (modern replacement for LIST)
MLSTMachine-readable single-object info
STATReturn server status (or, with a path, info about a path)
MDTMReturn last-modified time of a file
SIZEReturn file size in bytes
MFMTModify file's last-modified time
MFCTModify file's creation time
MFFModify file fact (generic)
DSIZReturn directory size
AVBLReturn available space at a path

Transfer

CommandDescription
RETRRetrieve (download) a file from the server
STORStore (upload) a file to the server
STOUStore unique (upload with auto-generated unique name)
APPEAppend to a file (or create if missing)
RESTRestart point — resume a transfer at a specific offset
ABORAbort the current transfer
ALLOAllocate disk space for an incoming file
TYPESet transfer type (A ASCII, I Image/binary)
MODESet transfer mode (Stream / Block / Compressed)
STRUSet file structure (File / Record / Page)

Data-connection setup

CommandDescription
PORTActive mode — tell the server which client port to connect to
PASVRequest passive mode — server opens a listening port
EPRTExtended PORT (supports IPv6)
EPSVExtended PASV (supports IPv6)
LPRTLong PORT (deprecated, replaced by EPRT)
LPSVLong PASV (deprecated, replaced by EPSV)
SPSVSingle-port passive mode

See our active vs passive FTP explainer for the practical implications.

File and directory management

CommandDescription
DELEDelete a file
RMDRemove an empty directory
RMDARemove a directory tree (recursive — uncommon)
MKDMake a directory
RNFRRename from (paired with RNTO)
RNTORename to (must follow RNFR)
XRMDRemove directory (deprecated synonym for RMD)
XMKDMake directory (deprecated synonym for MKD)
XRCPRemote copy (rarely implemented)

Server information and miscellaneous

CommandDescription
SYSTReturn the server's operating system identifier
HELPList available commands (or, with an argument, help for one command)
NOOPNo-op — used for keepalive
FEATList protocol features the server supports
OPTSSet options for a feature (e.g., OPTS UTF8 ON)
HOSTIdentify the desired virtual host on a multi-host server
LANGSet the language for server response messages
CSIDClient / server identification (rare)
THMBRequest a thumbnail of a remote image (rare)
SITESend 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 commandProtocol verb
getRETR
putSTOR
lsNLST or LIST
dirLIST
mkdirMKD
rmdirRMD
deleteDELE
cdCWD
pwdPWD
binaryTYPE I
asciiTYPE A
passive(toggle — affects PASV vs PORT for next transfer)
bye / quitQUIT

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 commandWorks in FTPWorks in SFTP
cd, ls, pwd, mkdir, rmdir, mget, mput, bye, quitYesYes
get, putYesYes
deleteYesNo — use rm
renameYesYes (rename <old> <new>)
binary, asciiYesNo — SFTP is binary-only
open, closeYesNo — connection model is different
passiveYesNo — SFTP doesn't have active/passive
reget, reputNoYes (resume support is native)
chmod, chownNo (no Unix-permission semantics in FTP)Yes
ln, symlinkNoYes

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:

  • Pythonftplib (FTP / FTPS) or paramiko (SFTP).
  • Node.jsbasic-ftp for FTP, ssh2 for SFTP.
  • curl / wget — for one-off shell scripts, curl --upload-file and curl -O are cleaner than driving the ftp CLI.
  • REST APIsFiles.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.

FTP, SFTP, FTPS — in a Modern UI

Files.com is the cloud File Orchestration Platform. Bring your FTP clients; pick up a real web file manager, share links, automations, and SOC 2 / HIPAA-BAA compliance.