Knowledgebase Β· Linux
Command-line FTP Tutorial
Last updated 2025-06-06
π‘ Introduction to FTP (File Transfer Protocol)
FTP is a standard protocol used to transfer files between a client and server. The ftp program is a command-line interface for this protocol, letting users upload, download, and manage files on remote servers.
π Getting Started
ftp abc.xyz.edu
Use the above command to connect to a server. Log in using your credentials or:
- Username:
anonymous - Password: your email address
π Basic Commands
ftp> help
Lists all available commands in the FTP session.
π Navigating Directories
ls # List remote files cd [directory] # Change remote directory cd .. # Go to parent directory lcd [directory] # Change local directory pwd # Show current remote directory
π Transfer Modes
ascii # Use for text files binary # Use for binary files (images, zips, etc.)
β¬οΈ Downloading Files
get image1.jpg # Download a single file mget *.jpg # Download multiple files
β¬οΈ Uploading Files
put image2.jpg # Upload a single file mput *.jpg # Upload multiple files
ποΈ File Management
delete image.jpg # Delete a remote file mdelete *.jpg # Delete multiple files mkdir newfolder # Create a remote directory rmdir oldfolder # Remove a remote directory
π₯οΈ Local Shell Commands
!ls # Run local system command
π Automate Transfers
prompt # Toggle confirmation for multiple transfers
β Ending the Session
quit # Exit FTP session
βοΈ Command-Line Options
| Option | Description |
|---|---|
| -p | Use passive mode (default) |
| -n | Disable auto-login |
| -i | Disable prompts for multiple file transfers |
| -e | Disable command editing |
| -g | Disable filename globbing |
| -v | Verbose mode: show all server replies |
| -d | Enable debug mode |
π§ Advanced FTP Commands (Quick Reference)
| Command | Description |
|---|---|
| append | Append a local file to a remote file |
| bell | Ring a bell after each transfer |
| case | Convert UPPERCASE remote filenames to lowercase |
| chmod | Change file permissions on the remote server |
| dir | List directory contents with details |
| glob | Toggle wildcard expansion for file lists |
| macdef | Define a macro for batch commands |
| rename | Rename a file on the remote server |
| status | Show current FTP status |
| type | Show or set file transfer type |
| user | Change login user |
β Aborting a File Transfer
To cancel a transfer, press Ctrl + C. For uploads, transfer stops immediately. For downloads, the remote server must support the ABOR command to stop quickly.
π File Naming Rules
-as filename = use standard input/output|command= pipe to shell command (e.g.,dir | more)- Wildcard expansion follows shell rules (unless disabled)
- Remote or local file names may be altered by
case,nmap,ntrans, orrunique
π Summary
The FTP client is a powerful command-line tool for transferring and managing files remotely. With a mix of basic and advanced features, it remains useful for automated scripts, server maintenance, and managing legacy systems.
Tell us what you need
Compare available plans or describe your workload so we can discuss a suitable starting point.