Transfer Files From The Command Line

A cool new service from The Netherlands is launched. It is called With a simple command from the terminal you can send a file to their server. You will get a short url back and you can share it because it is online available.

curl --upload-file ./hello.txt 

It will return you the url where it is hosted, for example

If you don’t like to type this every time you can copy the following script and put that in your .bash_profile, .bashrc or .zshrc.

# function for
transfer() {
  if [ $# -eq 0 ]; then echo "No arguments specified. Usage:\necho transfer /tmp/\ncat /tmp/ | transfer"; return 1; fi
  tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile;

There are a lot of more options how to use the service, see

Happy coding! – Found a mistake or a typo? Please submit a PR to my GitHub-repo.

Like this post? Follow @adriaandotcom on X