CloudsArk
Commands Linux

What Is the wget Command in Linux?

Learn what the wget command does in Linux, how its syntax works, and when to use it.

What Is the wget Command in Linux?

Introduction

The wget command downloads files from web and FTP URLs. It is useful for beginners, Linux administrators, DevOps engineers, and RHCSA students because it solves practical terminal tasks.

What the Command Does

Use wget to work with the specific Linux object it manages. Before changing anything, identify the target and run a read-only check when possible.

Basic Syntax

wget OPTIONS URL

The syntax includes the command, any options, and the target object.

Common Options

  • -O: choose the output filename.
  • -c: continue an interrupted download.
  • -r: download recursively.

Practical Examples

wget https://example.com/file.tar.gz
wget -O app.tar.gz https://example.com/releases/app.tar.gz
wget -c https://example.com/big.iso
wget -r -np https://example.com/docs/

Verification command:

ls -lh file.tar.gz

Example output:

-rw-r--r-- 1 admin admin 24M May 30 10:00 file.tar.gz

When to Use This Command

Use wget for non-interactive downloads, resumable downloads, and simple recursive retrieval. It is common in installation scripts and server setup notes.

Common Mistakes

  • Recursive downloads pulling much more content than expected.
  • Forgetting to quote URLs that contain ? or &.
  • Overwriting a local file because the output name was not checked first.

Quick Reference

wget https://example.com/file.tar.gz
wget -O app.tar.gz https://example.com/releases/app.tar.gz
ls -lh file.tar.gz

Summary

The wget command is safest when you understand the target, choose the right option, and verify the result with a separate command.