Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Linux Commands»Wget – Download files to Specific Directory

    Wget – Download files to Specific Directory

    RahulBy RahulJune 6, 20212 Mins ReadUpdated:June 10, 2021

    Wget is a free command-line utility for downloading files from the remote server. It supports HTTP, HTTPS, and FTP protocols, as well as follows the HTTP proxies servers.

    The default wget download files under the current working directory. In this tutorial, we will describe you to how to download files to a specific directory using wget.

    Using wget -O Option

    Use -O or --output-document=FILE option will truncate FILE immediately, and all downloaded content will be written to FILE. Here the wget -O FILE http://path is intended to work like wget -O - http://path > FILE;

    For example:

    wget -O /tmp/Ubuntu.iso https://releases.ubuntu.com/20.04/ubuntu-20.04-desktop-amd64.iso  
    

    The above command will download the remote ISO file with the Wget command and save it as /tmp/Ubuntu.iso in the local system. No matter what is the current working directory.

    Using wget -P Option

    Alternatively, Use -P or --directory-prefix=PREFIX. Here the PREFIX is a directory where all other files and subdirectories will be saved to. The default download directory is “.” the current directory.

    For example:

    wget -P /tmp https://releases.ubuntu.com/20.04/ubuntu-20.04-desktop-amd64.iso
    

    The above command will download the iso file under the /tmp directory.

    Conclusion

    In this guide, you have learned two methods to download files to a specified directory using the Wget command.

    command download wget
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleInitial Server Setup with Debian 10/9/8
    Next Article How To Set Up Laravel on Ubuntu 21.04 & 20.10

    Related Posts

    Download Ubuntu 22.04 – DVD ISO Images

    Updated:May 7, 20222 Mins Read

    How to Search Recently Modified Files in Linux

    2 Mins Read

    Bash Printf Command

    Updated:December 23, 20212 Mins Read

    (Resolved) -bash: /bin/mv: Argument list too long

    Updated:January 13, 20222 Mins Read

    tee Command in Linux with Examples

    Updated:July 1, 20224 Mins Read

    How to Scan Open Ports with Nmap

    5 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • How to run “npm start” through docker
    • Filesystem Hierarchy Structure (FHS) in Linux
    • How to accept user input in Python
    • What is difference between var, let and const in JavaScript?
    • What is CPU? – Definition, Types and Parts
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.