The Linux `wget` command retrieves files from web servers over HTTP, HTTPS, and FTP. Its non-interactive design makes it handy for scripts and long downloads. For API calls or sending data, `curl` may fit better—two useful tools with different strengths.

Multiple Choice

Which command is used to download a file from the internet in Linux?

The command used to download a file from the internet in Linux is widely recognized as `wget`. It is a command-line tool that retrieves content from web servers and is particularly useful for downloading files via HTTP, HTTPS, and FTP protocols. `wget` is known for its ability to download files non-interactively, meaning it can operate in the background without requiring user intervention, which is helpful for downloading large files or in scripts. While `curl` is also a correct tool for downloading files, it is often used for more than just downloading, such as interacting with APIs and sending data to web servers. Therefore, it is typically regarded alongside `wget` as another method but is not the primary choice for simple file downloads by many users. The options `scp` and `ftp` are alternatives primarily for file transfers, but they are not as straightforward for downloading files from the web as `wget`. `scp` is used for secure copy between machines over SSH, while `ftp` works with the File Transfer Protocol, which is less commonly used today due to security concerns compared to HTTP/S. Thus, the best choice for straightforward downloading of files from the internet in Linux, particularly for those seeking a dedicated and optimized tool for this purpose, is `wget

Downloading Files in Linux with wget

A Linux command line can fetch a file from the internet with a short command. One of the tools built for that job is wget. It can retrieve files over HTTP, HTTPS, and FTP, and it works without opening a browser or asking for input at every step. That makes it handy for a one-time download—and even more useful in scripts that need to run on their own.

The basic form is simple:


wget https://example.com/file.zip

By default, wget saves the file in the current directory, using the name at the end of the URL. If you run the command from your home folder, that’s where the file will land. Simple, right? Still, a few details can make downloads safer and easier to manage.

A small command with a clear job

The name wget comes from “web get.” It’s a command-line program for retrieving content from web servers and other supported sources. Unlike a graphical browser, it doesn’t need a window, tabs, or clicks. You give it a URL, and it gets to work.

That makes wget a natural fit for remote servers, shell scripts, and situations where a graphical desktop isn’t available. A system administrator might use it to fetch an archive onto a cloud server. A developer might use it to download a release file during a build. Or someone might simply want a file without opening a browser. The command behaves much the same in each case.

Most Linux distributions include wget or make it easy to install through their package manager. To check whether it’s available, run:


wget --version

If the shell says the command can’t be found, install it using the package manager for your distribution. The exact command varies: Debian and Ubuntu use apt, while Fedora uses dnf, for example. On a server, you may need administrator permissions to install software.

Save the file where you want it

The simplest command saves a file under its remote name in the current folder. To choose a different name, use -O (a capital letter O):


wget -O report.pdf https://example.com/files/latest-report

This is useful when a URL ends in a generic name, or when you want a consistent filename in a script. The capital letter matters: lowercase -o does something else. It writes wget’s log messages to a file.

You can also choose a directory:


wget -P ~/Downloads https://example.com/file.zip

Here, -P sets the destination folder. The directory must exist already; wget won’t always create a missing path for you. A quick ls ~/Downloads can confirm that the file arrived.

What happens during a download?

When you start a download, wget connects to the server, requests the resource, and writes the returned data to a local file. It usually displays progress, including the amount received and the estimated transfer rate. This feedback is reassuring, especially when the file is large and the progress bar seems to crawl.

Because wget can work non-interactively, it can also run in a script or scheduled job. For example, a shell script might fetch a data file each morning. The command doesn’t need someone to sit at the keyboard and answer a prompt. If the script needs to check for errors, it can use wget’s exit status, as with many Linux commands.

That non-interactive design is one of the tool’s strengths. It’s also a reminder to be careful: a script can download the wrong file just as efficiently as it can download the right one. Use URLs from sources you trust, and check what you received before running an unfamiliar program.

When the connection drops

A large download can fail because of a network interruption, a server issue, or a laptop being put to sleep. For many servers, wget can resume an incomplete download with -c:


wget -c https://example.com/large-archive.tar.gz

The command attempts to continue from the point where the existing file stopped. Whether this works depends on the server supporting the required behavior and on the local file still matching the download. If the server doesn’t support resuming, wget may start again or report that it can’t continue.

You can also limit download speed with --limit-rate. That can help when a download is competing with a video call or other work:


wget --limit-rate=500k https://example.com/large-archive.tar.gz

The value controls the transfer rate; k indicates kilobytes per second. It’s a small setting, but it can make a shared connection feel a lot less crowded.

wget and curl: similar, not identical

Linux users often have both wget and curl. They overlap, but they grew around different needs.

For a straightforward file download, wget is easy to read:


wget https://example.com/file.tar.gz

With curl, you’ll commonly use -O to keep the filename from the URL:


curl -O https://example.com/file.tar.gz

Without a filename option, curl normally sends the received content to standard output—the terminal, unless you redirect it. That behavior is useful when working with APIs, inspecting responses, or piping data into another command. For instance, curl is widely used to send requests and data to web services, not just to save files.

Neither tool is universally better. wget feels like a focused downloader, while curl is a flexible tool for transferring data between systems. On a Linux machine, knowing both is useful; for a basic file retrieval, wget is often the clearest place to start.

Why scp and ftp are different tools

A file can move between computers in several ways, but the method depends on where the file is stored. scp copies files between machines over SSH. It’s useful when you have access to a remote server account:


scp user@server.example:/home/user/archive.tar.gz .

That command copies a file from the remote server into the current local directory. It isn’t the usual choice for fetching a public file from a website, since it relies on SSH access and permissions on the remote machine.

FTP, meanwhile, is a file-transfer protocol with its own tools and workflows. Traditional FTP does not encrypt traffic, so passwords and file contents may be exposed on an untrusted network. Secure alternatives such as SFTP are often preferred for managed file transfers. For a public download hosted over HTTPS, wget or curl is usually more direct.

These tools can all move files, but they aren’t interchangeable. Think of them like different routes across town: one is built for a public web address, another for a server you can log into, and another for a legacy file-transfer setup.

A few sensible habits

Before downloading, check that the URL is spelled correctly and comes from a reliable source. Afterward, use ls -lh to inspect the file name and size:


ls -lh file.zip

For important downloads, compare a checksum if the publisher provides one. A checksum is a short value calculated from a file; matching it gives you evidence that the file arrived intact and hasn’t changed. It doesn’t prove that a file is safe by itself, but it’s a useful part of verifying a download.

Finally, remember where the command saves its output. The current working directory is easy to overlook, especially in a terminal session with several folders open. Run pwd to see your location, or use -P to name the destination directly.

Linux offers several ways to transfer files, each suited to a different setting. For a simple download from a web server, wget keeps the job plain: provide the address, choose a destination if needed, and let the command retrieve the file.