0
0
Linux CLIscripting~20 mins

wget for file downloads in Linux CLI - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Wget Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output of this wget command?
You run this command in a terminal:

wget --spider https://example.com/file.txt

What will wget do?
Linux CLI
wget --spider https://example.com/file.txt
ADownload the file but do not save it anywhere.
BDownload the file and save it as file.txt in the current folder.
CShow the content of the file in the terminal.
DCheck if the file exists on the server without downloading it, then print status.
Attempts:
2 left
💡 Hint
The --spider option makes wget act like a web spider.
💻 Command Output
intermediate
2:00remaining
What file name will wget save as?
You run this command:

wget https://example.com/downloads/report.pdf

What will be the name of the saved file?
Linux CLI
wget https://example.com/downloads/report.pdf
Adownloads
Breport.pdf
Cindex.html
Dfile.txt
Attempts:
2 left
💡 Hint
wget uses the last part of the URL path as the file name.
📝 Syntax
advanced
2:00remaining
Which wget command downloads a file and saves it with a custom name?
You want to download https://example.com/data.csv but save it as mydata.csv locally. Which command does this correctly?
Awget https://example.com/data.csv -O mydata.csv
Bwget -o mydata.csv https://example.com/data.csv
Cwget --save-as mydata.csv https://example.com/data.csv
Dwget --output-file=mydata.csv https://example.com/data.csv
Attempts:
2 left
💡 Hint
The -O option sets the output file name.
💻 Command Output
advanced
2:00remaining
What happens if you run wget with the -c option on a partially downloaded file?
You started downloading a large file but stopped halfway. You run:

wget -c https://example.com/largefile.zip

What will wget do?
Linux CLI
wget -c https://example.com/largefile.zip
ARestart the download from the beginning, overwriting the file.
BDownload the file but save it with a different name to avoid overwriting.
CResume the download from where it stopped, appending to the existing file.
DShow an error that the file already exists and stop.
Attempts:
2 left
💡 Hint
The -c option means continue.
🚀 Application
expert
3:00remaining
How to download multiple files listed in a text file using wget?
You have a file urls.txt with a list of URLs, one per line. Which wget command downloads all files listed in urls.txt?
Awget -i urls.txt
Bwget -f urls.txt
Cwget --list urls.txt
Dwget --input-file=urls.txt
Attempts:
2 left
💡 Hint
The -i option tells wget to read URLs from a file.