wget Command in Linux with Examples

Posted in

wget Command in Linux with Examples
sangeeta.gulia

Sangeeta Gulia
Last updated on December 25, 2024

    In this article, we will explore the Linux operating system, its commands, and one of the Linux commands, in particular, the wget command. This command is used to download files and packages from the remote server into your local machine.

    Wget command in Linux

    Even if some user is not logged in to the system, wget can also download files from the server. It is a non-interactive downloader. It works in the background without disturbing current running processes. Wget is a command line only. There isn't a library. To download a remote URL to a local file, wget does not require any further arguments. For SSL/TLS support, wget only supports GnuTLS or OpenSSL. The Syntax for this command is :

    wget [option] [URL

    Options of Wget command

    1. -v / –version

    This is used to show the version of wget is installed on your system. Its syntax is

    $wget -v

    2. -h / –help

    This is used to create a help message that lists all of the command line options available with the wget command line options. Its syntax is

    $wget -h [URL]

    3. -o logfile

    This option directs all system messages to the logfile given by the option, and after the procedure is complete, all messages created by the system are available in the log file.

    Its syntax is

    $wget -o logfile [URL]

    4. -b / –background

    This option is used to send a process to the background as soon as it starts, allowing other processes to run in the meanwhile. Its syntax is

    $wget -b [URL]

    5. -a

    This option is used to append the output messages to the current output log file without overwriting it, as the -o option does. However, by using this option, the previous command's log is saved, and the current log is written after the previous ones. Its syntax is

    $wget -a logfile [URL]

    6. -i

    To read URLs from a file, use this option. Its syntax is

    $wget -i inputfile,
    
    $wget -i inputfile [URL]

    7. -t number / –tries=number

    This option is used to limit the number of retries to a certain amount. Its syntax is

    $wget -t number [URL]

    Conclusion

    We talked about Linux, what Linux commands are, and one of them, the Wget command, in this article. We saw how we could use multiple options like -t, -i, -a, etc. options to download and read files from the remotes.

    People are also reading:

    Leave a Comment on this Post

    0 Comments