0
0
Linux CLIscripting~15 mins

wget for file downloads in Linux CLI - Mini Project: Build & Apply

Choose your learning style9 modes available
Downloading Files Using wget
📖 Scenario: You want to download files from the internet to your computer using the command line. This is useful when you need to get documents, images, or software quickly without opening a browser.
🎯 Goal: Learn how to use the wget command to download files from a URL and save them with a specific name.
📋 What You'll Learn
Use the wget command to download files
Specify the URL to download from
Save the downloaded file with a custom name
💡 Why This Matters
🌍 Real World
Downloading files from the internet quickly using the command line is common for software installation, data collection, and automation tasks.
💼 Career
Knowing how to use wget helps in system administration, data science, and development roles where automated file downloads are needed.
Progress0 / 4 steps
1
Set the URL to download
Create a variable called file_url and set it to the exact URL https://example.com/sample.txt.
Linux CLI
Need a hint?

Use the syntax variable=value without spaces for shell variables. Quotes are recommended for URLs.

2
Set the output file name
Create a variable called output_file and set it to the exact filename downloaded_sample.txt.
Linux CLI
Need a hint?

Remember to assign the filename as a string with quotes in shell variables.

3
Download the file using wget
Use the wget command with the -O option to download the file from $file_url and save it as $output_file.
Linux CLI
Need a hint?

The -O option lets you specify the output filename.

4
Verify the downloaded file
Use the ls command to list the file named $output_file and confirm it exists.
Linux CLI
Need a hint?

The ls command shows files in the current folder.