/

Downloading a File from a Server Using the Terminal

Downloading a File from a Server Using the Terminal

There are times when you may need to transfer a file from a server while connected through SSH. If you don’t want to set up an SFTP connection or aren’t sure if it’s allowed, you can use the scp command in a separate terminal window. In this article, we will discuss how to download a file from a server using the terminal.

To download a file from a server, follow these steps:

  1. Open your terminal window.
  2. Use the following syntax:
1
scp -i /.ssh/yourkey [USER]@[SERVER]:/path-to-file/on/server.txt ./

Replace [USER] and [SERVER] with your server details. Also, modify /path-to-file/on/server.txt with the correct path to the file on the server. Don’t forget to provide the path to your SSH key as well.

  1. By specifying ./ at the end of the command, the file will be downloaded to the same folder you are currently in. If you wish to download it to a different folder, change ./ to the desired folder path on your computer.

That’s it! You have successfully downloaded a file from the server using the terminal.

Tags: server, terminal, file transfer, download