Downloading Files with Curl and Wget

LinuxLinuxBeginner
Practice Now

Introduction

In this challenge, you need to get the file from Internet with curl and wget Command.

Achievements

  • curl - Download files from a URL, FTP server, a local filem or perform a simple HTTP test.
  • wget - Download files from a URL.

Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL linux(("`Linux`")) -.-> linux/PackagesandSoftwaresGroup(["`Packages and Softwares`"]) shell(("`Shell`")) -.-> shell/BasicSyntaxandStructureGroup(["`Basic Syntax and Structure`"]) shell(("`Shell`")) -.-> shell/VariableHandlingGroup(["`Variable Handling`"]) linux/PackagesandSoftwaresGroup -.-> linux/curl("`URL Data Transferring`") linux/PackagesandSoftwaresGroup -.-> linux/wget("`Non-interactive Downloading`") shell/BasicSyntaxandStructureGroup -.-> shell/quoting("`Quoting Mechanisms`") shell/VariableHandlingGroup -.-> shell/variables_decl("`Variable Declaration`") subgraph Lab Skills linux/curl -.-> lab-28{{"`Downloading Files with Curl and Wget`"}} linux/wget -.-> lab-28{{"`Downloading Files with Curl and Wget`"}} shell/quoting -.-> lab-28{{"`Downloading Files with Curl and Wget`"}} shell/variables_decl -.-> lab-28{{"`Downloading Files with Curl and Wget`"}} end

Download File With Curl Command

In this challenge, we provide a file for you to download. You need to get the file from Internet with curl command.

Here is the file URL: http://www.example.com/foo/bar.html

Example

challenge-file-acquisition-1-1.png

Requirements

  • Download the file from the URL with curl command.
  • Save the file to the ~/Desktop directory and renamed index.html.
  • Show error messages silently.

Make a HTTP Request

In this challenge, you need to make a HTTP request with curl command.

Example

challenge-file-acquisition-2-1.png

Requirements

  • Make a HTTP POST request to http://www.example.com with curl command.
  • Include request body foo=bar and Content-Type: application/json header.
  • Show the Response Headers.

Download File With Wget Command

In this challenge, we provide a file for you to download. You need to get the file from Internet with wget command.

Here is the file URL: http://www.example.com/index.html.

Example

challenge-file-acquisition-3-1.png

Requirements

  • Download the file from the URL with wget command.
  • Save the file to the ~/Desktop directory and renamed file.html.
  • Don't show progress meter or error messages.

Summary

Congratulations! You have completed the File Acquisition. You can practice more labs in LabEx to improve your skills.

Other Linux Tutorials you may like