Download Multiple Files by a Single Linux Command: A Beginner’s Guide
If you’re a Linux user, you may need to download multiple files at once for a variety of reasons. While you can download them one by one, it can be a time-consuming and tedious process. Luckily, there is a command that can make the process much simpler: wget.
In this blog post, we’ll explain how to use wget to download multiple files by a single Linux command.
Step 1: Install Wget
If you don’t have wget installed on your Linux system, you can install it using the following command:
sudo apt-get install wget
Step 2: Create a List of URLs
To download multiple files using wget, you need to create a text file that contains a list of URLs for the files you want to download. You can create the file using a text editor or by using the echo command. For example:
echo "https://example.com/file1.pdf" >> urls.txt
echo "https://example.com/file2.pdf" >> urls.txt
echo "https://example.com/file3.pdf" >> urls.txt
You can add as many URLs as you need to the file.
Step 3: Download the Files
Once you have created the list of URLs, you can use wget to download the files using the following command:
wget -i urls.txt
This command will read the list of URLs from the urls.txt file and download each file to the current directory. You can also specify a different directory to download the files to by adding the -P option followed by the directory path.
For example:
wget -i urls.txt -P /home/user/Downloads
This command will download the files to the /home/user/Downloads directory.
Conclusion
In this blog post, we’ve shown you how to use the wget command to download multiple files by a single Linux command. By creating a list of URLs and using the -i option with wget, you can download multiple files quickly and easily, saving you time and effort.
Recent Comments