Site icon LinuxCommands.site

How to download files using linux command line

When we use linux, we often encounter the situation of downloading files, so how do we use commands to download files in linux?

Today, I want to share with you two commonly used file download commands:

Syntax

curl [options] [URL...]
wget [option]  [URL]

Curl:

wget:

Examples

Use wget to download files

In the following example, we will use the wget command to download the ubuntu iso file. It is recommended to enclose the URL in double quotation marks (“).

wget "https://mirrors.nju.edu.cn/ubuntu-releases/21.04/ubuntu-21.04-desktop-amd64.iso"

If you want the standard output not to output content, you can use the -o or -a option to write the output to the log file.

wget "https://mirrors.nju.edu.cn/ubuntu-releases/21.04/ubuntu-21.04-desktop-amd64.iso" -o logfile

Use curl to download files

In the following example, we will use the curl command to download the Ubuntu iso file.

curl -o ubuntu.iso https://mirrors.nju.edu.cn/ubuntu-releases/21.04/ubuntu-21.04-desktop-amd64.iso

curl -O  https://mirrors.nju.edu.cn/ubuntu-releases/21.04/ubuntu-21.04-desktop-amd64.iso

Exit mobile version