Tutoriais Ubuntu

Use wput to send files through the network

You don’t have to open up your FTP client (whatever it is) to connect to the server when all you want is upload a single file or a bunch of directories.
Using wput is simple and very efficient when you want to do send files through FTP connections.
Ubuntu or Debian users can install wput using the apt-get command:

sudo apt-get install wput

Fedora users can do it with yum:

sudo yum install wput

And there’s a Windows version on sourceforge.
network connections

wput command syntax

To send all files from a local directory to the remote FTP server the syntax would be something like this:

wput *.* ftp://username:password@hostname/recipient-folder/

In the following examples I’ll assume my username is slinkydog and my password is dachshund. My server address would be (I didn’t check if it exists and it doesn’t matter. Use your own server names here). The recipient folder in the server will be called characters/.
This is the first example on how to send a single file through your FTP connection:

wput filename.txt

How to deal with wput verbosity

You can reduce the verbosity, using --less-verbose option:

wput --less-verbose filename.txt

You can use the option --verbose to increase the command output even more or the option quit to simply suppress verbosity.
I usually prefer to send wput to work in the background which sets my terminal free to run other stuffs. This is how to do it:

wput --background *.*

If you wantto know what’s happening (or happened) during the transference just read the file ./wputlog:

less ./wputlog

How to limit the bandwidth usage while sending files with wput

The option --limit-rate can be used to limit the average use of your network bandwidth. In the following example I’ll limit it to 500 K:

wput --limit-rate=500K --less-verbose about.php index.php styles.css

In the example above I limited the average rate of bandwidth usage to 500 K, decreased verbosity level and told wput to transfer the files:

  • about.php
  • index.php
  • styles.css

You can use wildcards like *.php if you want.

How to resume incomplete uploads with wput

Wput resumes incomplete transfers by default. So you don’t need to do anything special here.
Though you can force it to do it all again by telling the program to reupload:

wput --reupload --less-verbose --limit-rate=1M *.php *.css *.html

Take a look at the man page of the command to see more options:

man wput

… and have fun!

By Elias Praciano

Autor de tecnologia (livre, de preferência), apaixonado por programação e astronomia.
Fã de séries, como "Rick and Morty" e "BoJack Horseman".
Me siga no Twitter e vamos trocar ideias!

One reply on “Use wput to send files through the network”

Many thanks for these useful nuggets!
I’m trying to use wput on a Mac M1 running Ventura 13.5.2 in a bash script use credentials from .netrc. I can get everything working from command line but no joy in the script.
wput $infile “ftp://xxxxx:yyyyy” “$server/$outdir”
The login for my ftp account is an email address and I think the at sign is messing things up. Any thoughts please?

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.