Is wget or similar programs always available on POSIX systems?
Official list of POSIX 7 utilities
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/contents.html
The following are not present in the list:
- wget
- curl
- ftp
The same goes for the LSB which essentially only guarantees the POSIX utilities.
But I do think that the POSIX C is enough to implement most of netcat
functionality, so it is really a missed opportunity. E.g.: How to make an HTTP get request in C without libcurl?
Likely it is because network protocols like HTTP were deemed too specific/didn't exist at the time POSIX was still evolving, and POSIX basically froze forever. Notably, HTTPS encryption is likely not trivial to implement.
Curl is probably even more common than wget. At least in my experience merely because more other tools depend on it. But both curl and wget are a super simple install and will be available on any system.
Edit in 2019-11-04: I'm rewriting my answer to reflect the importance of ensuring that a transfer isn't tampered with while in flight. I'll leave my original answer below the rule.
I suggest using rsync
over ssh
to transfer your files. rsync
's interface may look overwhelming, but most users may be able to pick rsync -avzP
, and if you need more flexibility, rsync can adapt. Using ssh
will provide integrity, authenticity, and privacy to your connection.
curl
is the de facto standard for http transfers; if plain http or https are preferred, curl
or tools based on curl
are probably a good choice.
In my experience, tools are available about in this order:
wget
curl
sftp
ftp
GET
(I useHEAD
all the time and often forget it is just one tool in the suite)tftp
nc
(not as common as I wish)socat
(even less common)
The bash
/dev/tcp
tool is available on most systems I've used (some used dash
or pdksh
instead), but using echo
with bash
, nc
, or socat
is going the long-way-around for HTTP access -- you'll have to handle headers somehow, which reduces its elegance.
gnu awk (gawk) has built in TCP handeling even on non-linux systems http://www.gnu.org/software/gawk/manual/gawkinet/html_node/