Commands.page Logo

How to Download URLs from a Text File Using Wget on Ubuntu

This article provides a concise explanation of how to use the wget utility on Ubuntu to batch download files. It details the specific command needed to read a list of web addresses from a local text file and retrieve each resource automatically. By following these steps, users can efficiently manage multiple downloads without entering each URL individually.

To download a list of URLs from a text file using wget, you must use the -i flag. This option instructs wget to read the URLs from a specified file rather than from the command line arguments. Ensure that your text file contains one URL per line for proper processing.

The basic command syntax is:

wget -i filename.txt

Replace filename.txt with the actual name of your file containing the links. For example, if your list is saved as links.txt in your current working directory, execute the following command in the terminal:

wget -i links.txt

If the text file is located in a different directory, you must provide the full path to the file:

wget -i /home/user/documents/links.txt

Wget will process the file line by line, attempting to download each valid URL found within it. If a specific download fails, wget will report the error in the terminal output and continue to the next URL in the list. This method allows for unattended batch downloading of multiple resources on your Ubuntu system.