Preview:
Secure File Transfer Protocol (SFTP)

sftp> put – Upload file
sftp> get – Download file
sftp> cd path – Change remote directory to ‘path’
sftp> pwd – Display remote working directory
sftp> lcd path – Change the local directory to ‘path’
sftp> lpwd – Display local working directory
sftp> ls – Display the contents of the remote working directory
sftp> lls – Display the contents of the local working directory


sftp -P port usrename@your_server_ip_or_domain
I.e
sftp -P 39922 root@45.58.35.53

zip -r filename.zip /path/to/folder1


Secure Copy Protocol (SCP)

-p: Use passive mode. This is not directly related to specifying the port but is a commonly used option for FTP connections.
-u username: Specify the username to use for the FTP connection.
hostname: The IP address or domain name of the FTP server.
port: The port number on which the FTP server is running.


-P 39922: Specifies the SSH port on the remote server (replace 39922 with your actual port if different).
root: The username on the remote server.
45.58.35.53: The IP address or hostname of the remote server.
/path/on/remote/server/file: The path to the file on the remote server.
/path/on/local/machine: The destination path on your local machine.




For upload File
scp destinationor  source
scp -P 39922 /path/on/local/machine/file  root@45.58.35.55:/path/on/remote/server
scp -P 39922 /home/hur/quickinvoice_details_202309202129.sql root@45.58.35.53:/var/www/html/

For Download File
scp source destinationor
scp -P 39922 root@45.58.35.55:/path/on/remote/server/file /path/on/local/machine
I.e
scp -P 39922 root@45.58.35.53:/var/www/html/quickinvoice_details_202309202129.sql /home/hur/Music





Rsync to copy or sync files between your servers
rsync [option] [source] [destination]
-a | copy files recursively
-h | produce a readable output
–progress | displays the process while the command is being run
-q | processes running in the background will not be shown
-v | processes that are run will be written out for the user to read
-z | compress the data

rsync [option] [source] user@hostname-or-ip:[destination path]

rsync -avh root@5.252.161.46:/home/receive-rsync/ /home/test-rsync/ 
I.e
rsync -e "ssh -p 39922" root@45.58.35.53:/var/www/html/quickinvoice_details_202309202129.sql /home/hur/Videos
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter