Linux Administrator

How To Download File From Server Using SSH

Written by Santosh Prasad

Secure Shell (SSH) is a protocol which is used to access Linux servers remotely. In short, we can say it allows the secure exchange of data between two computers. Commonly port 22 is used to connect one computer to another

SCP command is uses the SSH protocol for copying the file between remote and local machine.

Download File Using SSH

We can use SCP command to download the from remote server. For example I am going to download a file called “test.tar.gz” which is located on remote server /opt directory in our local system /var directory. You can replace the values as per your requirement.

# scp [email protected]:/opt/test.tar.gz /var/

If your SSH service running on different port (2022) then you can simply mention the port using –P option with SCP command.

# scp -P 2022 [email protected]:/opt/test.tar.gz /var/4

In case your remote server require key base authentication such as public and private key then you can use –i option followed by private key file to connect your remote server using the SCP command.

# scp -i private_key.pem [email protected]:/opt/test.tar.gz /var/

Uploading File Using SSH

Now you can also upload a file to the remote server using SSH protocol using SCP command. Follow the below command to upload the file on remote SSH server.

# scp /var/test.tar.gz [email protected]:/var/www/html/


Thank you! for visiting Look Linux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website To become an author at Look Linux Submit Article. Stay connected to Facebook.

About the author


Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Leave a Comment