The sftp
(Secure File Transfer Protocol) command is a secure way to transfer files between two servers over an SSH connection.
Here is an example of how to use sftp
to transfer a file from one server to another:
- Open a terminal on the source server and log in to the destination server using
sftp
:
sftp user@destination_server
Replace “user” with your username on the destination server and “destination_server” with the hostname or IP address of the destination server.
- Once you have logged in, you can use the
put
command to transfer a file from the source server to the destination server:
put filename
Replace “filename” with the name of the file you want to transfer.
- After the file has been transferred, you can use the
exit
command to log out of thesftp
session:
exit
Note that you can also use the get
command to transfer a file from the destination server to the source server. The syntax is similar to the put
command, just replace put
with get
.
sftp
is a secure and efficient way to transfer files between servers, and is often used for transferring large files or for automating file transfers as part of a script or program.