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 has to stay up.
A short conversation with an engineer. No quote-bot, no callback queue. We'll tell you honestly if we're not the right fit.