Specify output file using wget

wget can be used to download file from any server. However everytime you execute the command, it saves the copy of file instead of replacing the file if already exists.

wget provides a flag that can be used to download the file to a specific location:

wget -O <OUTPUT_FILE_NAME> or wget --output-document =<OUTPUT_FILE_NAME>

Word of caution: Use of ‘ -O’ is not intended to mean simply “use the name file instead of the one in the URL;” rather, it is analogous to shell redirection: ‘ wget -O file http://foo ’ is intended to work like ‘ wget -O – http://foo > file ’; file will be truncated immediately, and all downloaded content will be written there.

Posted in Linux

Leave a Reply

Your email address will not be published. Required fields are marked *