Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk10 min

How to Use wget to Download Files on a Linux Server

A practical Linux-server guide to wget, covering filenames, destination directories, resumable downloads, retries, bandwidth limits, background jobs, recursive trees, and careful website mirroring.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

wget URL is the essential command: it downloads the response into the shell’s current directory. Add -O when you need an exact filename, -P when you need a destination directory, -c to continue a partial file, --limit-rate to protect a shared connection, and -b for a job that should keep running after you return to the prompt. For directory trees, combine -r with a deliberate depth and --no-parent; use --mirror only when you really intend an unlimited recursive mirror.

What wget does on a Linux server

wget is a non-interactive command-line network downloader. It is useful over SSH and in scripts because it starts from a URL, writes files to disk, and does not require an interactive browser session. The GNU manual available for this guide is version 1.25.0, but the binary installed on your server may be older or newer. Run man wget on that host before relying on an option whose behavior matters to an automated job.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Examples below use ordinary shell syntax and placeholder URLs. Replace them with the URL you are authorized to retrieve and with directories that the account running the command can write to.

Download one file

The default command

wget https://example.com/releases/archive.tar.gz

The file is saved in the shell’s current working directory. To see that directory before starting, run pwd; use ls -lh afterward to confirm the result and its size. If a file with the same name is already present, do not assume that the new transfer will be a continuation. Use the resume procedure below when you have a known partial download.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

Choose an exact filename with -O

wget -O latest-archive.tar.gz https://example.com/releases/archive.tar.gz

-O writes the response under the name you provide. It is useful when the server’s URL contains a generated name or when a script needs a stable filename. A full path can be supplied, for example:

wget -O /srv/downloads/latest-archive.tar.gz https://example.com/releases/archive.tar.gz

Create the destination first and ensure the account has permission to write there. Treat -O as a deliberate output choice: it directs the transfer to that one path rather than letting wget derive a filename from the URL.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose a directory with -P

wget -P /srv/downloads https://example.com/releases/archive.tar.gz

-P sets the target directory while retaining the filename selected from the URL. Without it, the target is the current directory. This form is convenient when several URLs should be placed in the same directory.

A full path passed to -O already specifies both directory and filename, so adding -P is redundant and can make a script harder to read. Choose one explicit output strategy for each command.

Need Option Example Result
Use the URL-derived name in the current directory none wget URL Writes to the current working directory.
Set the complete output path -O name wget -O /srv/downloads/image.iso URL Writes as image.iso at that path.
Set only the destination directory -P dir wget -P /srv/downloads URL Keeps the URL-derived filename in /srv/downloads.

Resume an interrupted download safely

Use -c with the existing partial file

cd /srv/downloads
wget -c https://example.com/images/disk-image.iso

The -c (continue) option asks wget to continue a partial download instead of starting from zero. The local partial file must still exist, and it must be in the location where wget is looking. Change to that directory first, or combine the same destination choices used for the original command so that the filename and path match.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

For a fixed filename, repeat the original -O choice:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
wget -c -O /srv/downloads/disk-image.iso https://example.com/images/disk-image.iso

When continuation is not possible

Resuming depends on the server supporting partial downloads. If it does not, wget restarts the transfer and overwrites the existing file completely. That behavior can turn a supposedly efficient retry into another full transfer, which matters for large images and metered links. If a continuation repeatedly begins at byte zero, verify the server’s support for partial requests and plan for a complete redownload rather than repeatedly invoking -c.

  • Keep the partial file in the same working location used by the original command.
  • Do not rename the partial file unless you also supply the matching output name.
  • Check available disk space before retrying a large object; a restart needs room for the complete file.

Make long or fragile transfers more reliable

Retry a finite number of times

wget --tries=5 https://example.com/releases/archive.tar.gz

--tries=N sets the retry count. The documented default is 20. A value of 0 or inf requests infinite retries, which can leave an unattended process running indefinitely; use that only when an external job supervisor is responsible for stopping it.

Retries do not change the destination or turn a non-resumable server into a resumable one. For a large transfer, combine a sensible retry count with -c when a partial file is retained:

wget -c --tries=5 -P /srv/downloads https://example.com/releases/archive.tar.gz

Limit bandwidth on shared links

wget --limit-rate=200k https://example.com/releases/archive.tar.gz

--limit-rate caps the transfer rate. The documented suffixes include k and m; the value represents bytes per second, so 200k requests approximately 200 kilobytes per second. Use a cap when the server also carries interactive workloads, when several users share the uplink, or when a download should not consume the entire connection.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

The cap is per wget process. Starting several capped processes can still consume the link collectively, so account for all concurrent jobs when choosing a limit.

Run wget in the background

wget -b https://example.com/releases/archive.tar.gz

-b moves wget into the background immediately after startup, returning control of the shell while the transfer continues. Use it for a download that should outlive the command prompt, but arrange a way to inspect the process and its output on your system. Because the exact default log filename was not established here, check the command’s output and the installed manual rather than assuming a particular log path.

A practical combined command

wget -b --tries=5 --limit-rate=500k -P ~/downloads https://example.com/file.iso

This command starts in the background, allows five attempts, caps the transfer at 500 KB/s, and places the URL-derived filename in ~/downloads. The options are independent: remove -b when you need to watch progress interactively, or remove the rate cap when bandwidth is not a concern.

Download a directory tree

Start recursion with -r

wget -r https://example.com/gallery/

-r enables recursive retrieval. Wget follows links under the starting location and saves the resulting hierarchy. The default maximum recursion depth is 5. Set an explicit depth with -l when you know how far the tree should extend:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
wget -r -l 2 https://example.com/gallery/

Use -l 0 or -l inf to remove the depth limit. Unlimited recursion is powerful but potentially expensive: a broad site can contain a very large number of links, and deep crawling can burden both your server and the remote web server.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

Prevent traversal above the starting directory

wget -r -l 2 --no-parent https://example.com/gallery/

--no-parent prevents wget from climbing to directories above the URL you supplied. It is the normal safety boundary for downloading a public directory-like path. Keep the trailing slash when the server’s URL structure uses it to identify the starting directory, and set a depth that matches the content you actually need.

Keep only selected file types

wget -r -l 2 --no-parent --accept=jpg,png,gif https://example.com/gallery/

--accept allows matching file extensions; --reject excludes matching types. The example keeps common image files while still traversing links within the permitted depth and starting tree:

wget -r -l 2 --no-parent --reject=zip,tar.gz https://example.com/gallery/

Filters are filename-based. Test the pattern on a small depth before launching a large crawl, and inspect the resulting directory so that an extension rule has not excluded a format you needed.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Mirror a website for local use

What --mirror changes

wget --mirror https://example.com/docs/

--mirror is an alias for -r -N -l inf --no-remove-listing. In other words, it enables recursion with unlimited depth, timestamp-based updating, and retention of directory listings. It is not a modest “download this folder” switch; it requests an unlimited recursive operation and should be treated as a potentially large job.

Fetch page requisites and rewrite links

wget --mirror -p -k https://example.com/docs/

Add -p to fetch page requisites such as resources needed by downloaded pages, and -k to convert links for local viewing. The result is intended for an offline copy, but it can still be incomplete when a site builds content dynamically or keeps resources outside the allowed tree. Keep the scope narrow and review the output before treating it as a faithful site backup.

Safer mirror planning

  • Begin with a specific starting path rather than a site-wide homepage.
  • Add --no-parent when the mirror must stay below that path.
  • Use --limit-rate on shared infrastructure and choose a finite depth when unlimited recursion is unnecessary.
  • Expect a recursive operation to consume substantially more disk space and time than a single-file download.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Option reference

Option Purpose Important qualification
-O name Write to a specified filename or path. A full path already selects the directory; pairing it with -P is redundant.
-P dir Write URL-derived filenames in a specified directory. The default destination is the current directory.
-c Continue an existing partial file. Requires the partial file to remain in the expected location; unsupported servers cause a full restart and overwrite.
--limit-rate=200k Cap transfer speed in bytes per second. k and m suffixes are available; the cap applies to that wget process.
-b Run in the background after startup. Use the installed manual and command output to identify logging details on your host.
--tries=N Set retry attempts. Default is 20; 0 or inf means infinite retries.
-r Enable recursive retrieval. Default maximum depth is 5.
-l depth Set recursion depth. 0 or inf removes the depth limit.
--no-parent Stay below the starting directory. Use it when crawling a directory-like URL.
--accept / --reject Filter filenames during recursion. Patterns should be tested against the site’s actual filenames.
--mirror Enable recursive, unlimited, timestamp-aware mirroring. Equivalent to -r -N -l inf --no-remove-listing; use deliberately.
-p Fetch page requisites. Usually paired with a mirror intended for local page viewing.
-k Convert links for local viewing. Useful with --mirror -p.

Common failure modes and fixes

The file is not where you expected

Wget writes to the current directory unless you use -P or a full path with -O. Run pwd, then inspect that directory with ls -lh. For repeatable scripts, use an absolute destination such as -P /srv/downloads rather than relying on whoever launched the shell.

-c starts over

Confirm that the partial file still exists under the same name and in the same location. If those conditions are met, the remote server may not support partial downloads; wget then performs a complete transfer and overwrites the file. Do not keep retrying under the assumption that the transfer will become resumable.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The recursive job downloads too much

Reduce the scope with -l, add --no-parent, and apply --accept or --reject. A default depth of 5 may still be broader than intended, while --mirror deliberately removes the depth limit. Stop an oversized job, remove any unwanted partial tree, and restart with explicit boundaries.

The transfer affects other users

Add --limit-rate and consider running the job with -b only after confirming its destination and retry behavior interactively. A background process is less visible, not less demanding; monitor the host’s network and disk usage through your normal administration tools.

The command keeps retrying

Inspect --tries. The default is 20, while 0 and inf are intentionally endless. Replace an infinite setting with a finite count when an unattended job must eventually fail and alert another system.

A repeatable workflow for server downloads

  1. Check the installed behavior. Run man wget and confirm the version and options on the target server; the GNU manual referenced here describes Wget 1.25.0, but installations differ.
  2. Choose a writable destination. Decide whether the script needs a fixed filename (-O) or a common directory (-P). Avoid combining both unless you have a specific reason.
  3. Start interactively. Run the basic command without -b so you can see the initial response and verify the path.
  4. Add resilience deliberately. Use -c for a retained partial file, a finite --tries value for retries, and --limit-rate when the connection is shared.
  5. Background only after validation. Add -b once the command works in the foreground and you know how you will inspect its progress and output.
  6. Constrain recursion. For trees, specify -r, an explicit -l, and --no-parent; add filename filters only when they match the content you need.
  7. Verify the result. List the destination, check file sizes, and confirm that the number and structure of downloaded files match the job’s purpose before consuming or publishing them.

Choosing the right command

Situation Command pattern Why
One file, normal connection wget URL Uses the current directory and URL-derived filename.
One file, fixed name wget -O name URL Produces a predictable path for scripts.
Several files in one directory wget -P dir URL Separates destination management from URL filenames.
Interrupted large file wget -c URL Continues the retained partial file when the server supports it.
Shared or metered link wget --limit-rate=200k URL Caps this process’s bandwidth use.
Long unattended transfer wget -b --tries=5 URL Background execution with a finite retry policy.
Specific directory tree wget -r -l 2 --no-parent URL Recurses only to a stated depth below the starting path.
Offline-oriented mirror wget --mirror -p -k URL Uses unlimited recursion, requisites, and local-link conversion; requires careful scope and resource planning.

Bottom line

Start with the smallest command that matches the job. Use -O or -P to control placement, -c only when a partial file and server support make continuation meaningful, and combine finite retries, a rate cap, and background mode for long-running transfers. Treat recursive options—especially --mirror—as bounded crawling tasks: set the path and depth first, protect shared bandwidth, and verify what landed on disk.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.