Download and Upload files to server through terminal
Author: Al-mamun Sarkar
Date: 2021-03-29 13:48:24
We can download and upload files to the remote server through the terminal using scp command.
Upload file to the server:
Syntex:
scp [source-file] [username]@[destination server]:/destination-path
Example:
scp project.zip root@example.com:/var/www/html
OR
scp project.zip root@123.142.123.43:/var/www/html
You can use either domain name or server IP address. Don't forget to replace filename (project.zip), username (root) and IP address(123.142.123.43)
Download file from the server:
Syntex:
scp [username]@[destination server]:/destination-path/filename [local-path]
Example:
scp root@example.com:/var/www/html/project.zip /var/www/html/
OR
scp root@123.142.123.43:/var/www/html/project.zip /var/www/html/
Same here you can use the domain name or server IP address. It's import if you don't replace filename (project.zip), the username (root), and IP address(123.142.123.43) then you will not be able to download or upload.