FTP (File Transfer Protocol) is used to transfer files between computers over a network. Below are the main FTP commands with descriptions and examples.
1. Connection and Navigation
open – connect to an FTP server.
Syntax: open <hostname> [port]
Example:
open ftp.example.com
open ftp.example.com 21
user – log in with a username.
Syntax: user <username> <password>
Example:
user myuser mypassword
bye / quit – exit the FTP session.
Syntax: bye or quit
Example:
bye
cd – change the current directory on the server.
Syntax: cd <directory>
Example:
cd /public_html
lcd – change the current local directory.
Syntax: lcd <directory>
Example:
lcd C:UsersuserDocuments
pwd – show the current directory on the server.
Example:
pwd
dir / ls / nlist – list directory contents on the server.
Example:
dir
ls
nlist
2. File Management
get – download a file from the FTP server.
Syntax: get <remote_file> [local_file]
Example:
get file.txt
get file.txt local_copy.txt
mget – download multiple files from the server.
Syntax: mget <file_pattern>
Example:
mget *.txt
put – upload a file to the server.
Syntax: put <local_file> [remote_file]
Example:
put file.txt
put local.txt remote.txt
mput – upload multiple files to the server.
Syntax: mput <file_pattern>
Example:
mput *.html
delete – delete a file on the server.
Syntax: delete <filename>
Example:
delete oldfile.txt
mdelete – delete multiple files.
Syntax: mdelete <file_pattern>
Example:
mdelete *.bak
rename / rn – rename a file on the server.
Syntax: rename <old_name> <new_name>
Example:
rename old.txt new.txt
mkdir / xmkdir – create a directory on the server.
Syntax: mkdir <directory>
Example:
mkdir new_folder
rmdir / xrmdir – remove a directory on the server.
Syntax: rmdir <directory>
Example:
rmdir old_folder
3. Transfer Management
ascii / text – set text transfer mode.
Example:
ascii
binary / image – set binary transfer mode.
Example:
binary
get -resume / reget – resume downloading a file.
Example:
reget file.txt
put -resume / reput – resume uploading a file.
Example:
reput file.txt
prompt – enable or disable interactive mode for mget and mput.
Example:
prompt
status – show current FTP session status.
Example:
status
help / ? – show command list or help for a specific command.
Example:
help
help get