← Back to list

Linux Administration: wget and curl Commands

In this guide, we will cover wget and curl, two command-line utilities used for downloading data from the web.

Hyunjae · 2026-08-19 15:29 · 8 claps · 2.5 min read
#linux #red-hat #sysadmin #devops #curl
Open on Medium ↗
Wiki topics: ML · Machine Learning ☁️ · DevOps & Cloud 🔓 · Open Source 🥊 · Combat Sports

Linux Administration: wget and curl Commands

In this guide, we will cover wget and curl, two command-line utilities used for downloading data from the web.

The difference between the two lies in their core capabilities: wget is a non-interactive, one-way downloader capable of recursive downloads, making it ideal for retrieving large files or downloading entire websites. On the other hand, curl supports bidirectional data transfer, making it better suited for uploading data or testing APIs like REST services, while offering more flexible functionality.

Downloading Files with wget

First, check whether the wget package is installed using the rpm -q wget command. If it is not installed, install it with dnf -y install wget.

Next, navigate to https://www.gimp.org/downloads, right-click the Download directly button, and click Copy Link to copy the download URL for GIMP, an open-source image editor.

Now, download the installation file using the wget -O GIMP-3.0.8.AppImage <download_link> command, and verify that the file has been downloaded successfully using the ls -l command.

Note: Here, the -O option renames the downloaded file to GIMP-3.0.8.AppImage. There are various other options available, which you can check using the wget --help command. To highlight a few:

  • -c: Resumes an interrupted download (If the server supports this capability).
  • -i: Reads URLs from an input file to perform downloads.

GIMP Image Editor

GIMP Image Editor

Using wget command

Using wget command

Using the curl Command

Next, let’s download the website https://kernel.org as an index.html file using the curl -o index.html https://kernel.org command.

Move the file to the Apache web server directory using the mv index.html /var/www/html command, and modify the SELinux file context using the semanage fcontext -a -t httpd_sys_content_t index.html and restorecon index.html commands.

Finally, restart the Apache service using the systemctl restart httpd command and test it in a browser to confirm that the website loads properly.

Using curl command

Using curl command

Configuring Apache web server and changing SELinux file context

Configuring Apache web server and changing SELinux file context

Restarting service and testing access

Restarting service and testing access

Testing REST APIs with curl

As mentioned earlier, curl supports bidirectional communication, making it well-suited for testing APIs. Since testing an actual API requires setting up an API server, we will use a hypothetical REST API endpoint at https://school.com/api/students for reference examples only.

The examples below demonstrate how to test the four core functions of a REST API — GET (Read), POST (Create), PUT (Update), and DELETE (Delete) — using the curl command.

# GET(Read)
# Multiple
curl https://school.com/api/students

# Single
curl https://school.com/api/students/1

# POST(Create)
curl -X POST https://school.com/api/students/create \
     -d '{ "name" : "Ryan", "age" : "15" }' \
     -H "Content-Type: application/json"

# PUT(Update)
curl -X PUT https://school.com/api/students/update/25 \
     -d '{ "name" : "James", "age" : "17" }' \
     -H "Content-Type: application/json"

# DELETE(Delete)
curl -X DELETE https://school.com/api/students/delete/25

메타데이터
post_id
5a6c4ec7b1bf
slug
linux-administration-wget-and-curl-commands-5a6c4ec7b1bf
url
https://medium.com/@hjkim6321/linux-administration-wget-and-curl-commands-5a6c4ec7b1bf
canonical_url
https://medium.com/@hjkim6321/linux-administration-wget-and-curl-commands-5a6c4ec7b1bf
author_url
https://medium.com/@hjkim6321
status
ok
fetched_at
2026-09-18 06:21:58