Downloading a file from the shell using a URL

Expertise level: Easy

If you have to download a file from the shell using a URL, follow these steps:

  • Login with SSH as root.
  • Navigate to the directory where you want to download the file using cd command:
cd /path/to/directory/
  • Type the following command:

(For example, the file to be downloaded is at http://domain.com/file.txt)

wget http://domain.com/file.txt 

The file.txt file will then be on the server into the directory: /path/to/directory/

If you wish to download a file and save it with a different name, you can use the -O flag:

wget -O /path/to/place/file/file2.txt http://domain.com/file.txt

In this example, file.txt will be copied to file2.txt.

For more information, please consult the official documentation: http://www.gnu.org/software/wget/manual/wget.html

Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk