Recall & Review
beginner
What command is commonly used in Bash to download files from the internet?
The
curl command is commonly used to download files from the internet in Bash. Another popular command is wget.Click to reveal answer
beginner
How do you save a file with a specific name using
curl?Use the
-o option followed by the desired filename. Example: curl -o myfile.txt https://example.com/file.txt saves the file as myfile.txt.Click to reveal answer
intermediate
What does the
-L option do in curl?The
-L option tells curl to follow redirects. This is useful when the URL redirects to another location before the file is downloaded.Click to reveal answer
intermediate
How can you automate downloading multiple files in Bash?
You can use a loop to iterate over a list of URLs and download each file using
curl or wget. For example, a for loop with URLs stored in an array.Click to reveal answer
beginner
Why is it helpful to check if a file already exists before downloading it in a script?
Checking if a file exists prevents unnecessary downloads, saves bandwidth, and avoids overwriting files. This makes the script more efficient and safer.
Click to reveal answer
Which command option saves a downloaded file with a specific name using curl?
✗ Incorrect
The
-o option in curl specifies the output filename.What does the
-L option do in curl?✗ Incorrect
The
-L option makes curl follow HTTP redirects automatically.Which Bash structure is best for downloading multiple files automatically?
✗ Incorrect
A
for loop is commonly used to iterate over a list of URLs to download multiple files.Why check if a file exists before downloading in a script?
✗ Incorrect
Checking file existence avoids unnecessary downloads and prevents overwriting existing files.
Which command can also be used to download files besides curl?
✗ Incorrect
wget is another popular command-line tool for downloading files.Explain how you would write a Bash script to download a list of files from URLs stored in an array.
Think about looping through each URL and using curl with -o option.
You got /4 concepts.
Describe why following redirects is important when automating file downloads and how to enable it in curl.
Consider what happens if the file is moved to a new address.
You got /3 concepts.