Wget

From Leo's Notes
Revision as of 19:13, 24 February 2017 by Leo (talk | contribs) (Text replacement - "<code>" to "{{code|")
This page was last edited on 24 February 2017, at 19:13.

wget to console

Use the {{code|-O - option to output contents to the console.

wget -O - http://google.ca

Since the contents go to {{code|stdout, you can pipe it to a shell to execute remote commands:

wget -O - http://scripthost.local/fix_graphics.sh

Note: This is equivalent to using just {{code|curl http://google.ca.

Save to Directory

Use the {{code|-P to specify the prefix of the output file.

wget -P /tmp http://google.ca/

Saving an Entire Open Directory

To download an entire open directory from a remote server:

wget -np -r http://server/remote/dir

wget on FreeBSD

wget is available in ports under {{code|ftp/wget. If you don't want to compile it, you could just use {{code|fetch (1) to download files.