The sftp
command in the Debian Almquist Shell (dash) is used for secure file transfer over the SSH protocol. It allows users to transfer files to and from a remote server securely, making it a preferred choice for many when dealing with sensitive data.
The basic syntax of the sftp
command is as follows:
sftp [options] [user@]host
-o
: Specify options in the format used in the SSH command.-P
: Specify the port to connect to on the remote host.-b
: Use a batch file for non-interactive mode.-v
: Enable verbose mode for debugging.Here are some practical examples of using the sftp
command:
sftp user@hostname
sftp user@hostname:/path/to/remote/dir <<< $'put localfile.txt'
sftp user@hostname:/path/to/remote/file.txt <<< $'get file.txt'
sftp -P 2222 user@hostname
sftp -b batchfile.txt user@hostname
-v
option when troubleshooting connection issues to get detailed output.