Skip to content

[Linux] Use "wget" command to download file

We usually use wget command in Linux, its main purpose is to download resources on the Internet.

For example, if you want to download a picture today, you only need to copy the address of the picture.

And open your terminal:

wget "FILE_URL"

And then you are download this picture. After downloading, you can open the picture to have a look.

Is it convenient? We can also use this method to download file in remote server.

In order to facilitate future viewing, I will record the commands commonly used in wget below.

If you are interested in the wget command in Linux, you can refer to the official website: https://www.gnu.org/software/wget/


wget

parameter nameParameter targetDescription
-VShow wget version
-hShow wget help message
-b
-ecommandExecute the'.wgetrc' command
-ofile nameOutput log message
-afile nameAdd log message
-dPrint out Debug message
-qDo not display output messages
-v(Default)
-nvCancel details
-ifile nameDownload the URL from the file (batch)
-FTreat download files as HTML
-t--tries = numberdownload times
--retry-connrefusedRejected still download
-Ofile nameName and save the downloaded file
-ncDo not overwrite existing files
-c--contiueContinue to get the unfinished part
-NDownload only files that are newer than local files
-SPrint out server return message
-TSet timeout
-w--wait = secondNumber of seconds to wait for retrieval time
-ndDo not create a directory
-xStrong to create a directory
-nHDo not create a host directory
--http-user=UserSet HTTP username
--http-passwd=PassSet HTTP user password

Record

This is the part that I think will be used frequently at present, not all commands. If there is a command you need, you can use "wget -h" to see if there is such a function.

If there are more frequently used functions in the future, I think I will update this article again.

Tags:

Leave a Reply