Linux Terminal Command: sftp
The sftp command is an essential tool in Network Utilities. In this tutorial, we will explore what sftp does, look at everyday examples, and cover advanced options to supercharge your command-line workflow.
Concept & Explanation
The sftp command is an interactive client for secure file transfers over SSH connection channels.
Common Options & Syntax
sftp [options] [arguments]
Here are the most common flags used with sftp:
- Simple Usage: Basic default commands.
- Detailed View: Shows diagnostic information.
- Advanced Actions: Can chain parameters for scripting.
1. Interactive Example (Simple)
Here is how most people run the command:
# Example
sftp user@host.com
What it does: Opens an interactive SFTP session to upload or download files.
2. Power-User Example (Advanced)
For scripting and advanced diagnostics, use this configuration:
# Advanced
sftp -P 2222 -b transfer_commands.txt user@host.com
What it does: Runs SFTP in batch mode (-b), executing transfer commands (like put, get) written in a text file.
⚙️ Warning & Common Pitfalls
[!WARNING] Unlike standard FTP, SFTP works over SSH (default port 22). Do not confuse it with FTPS, which is FTP over SSL/TLS.
🔗 Related Commands
Here are some related posts on cli_tty1 you might want to check out:
- which : Locate a command in the user path environment.