Can you tftp download a file in one line

tftp

I want to script the download of a file without having to enter tftp's command prompt. I've found that I can sort of achieve this with a here-document:

tftp 192.168.1.2 69 << _EOF_
  get testfile
  quit
_EOF

But I was hoping for something simpler, and closer to something as follows:

wget 192.168.1.2:69:/tftpboot/testfile

Best Answer

You probably have the Linux NetKit TFTP client.

H. Peter Anvin's TFTP client (in the tftp-hpa package in Debian) has a command line option -c that does what you want:

-c command

Execute command as if it had been entered on the tftp prompt. Must be specified last on the command line.

Example:

tftp -m binary  "localhost"  -c get "pxelinux.0"
Related Question