Transfer Files from the Command Line with transfer.sh

Dmitri Popov

Productivity Sauce

Oct 09, 2014 GMT
Dmitri Popov

Need to share a file without leaving the convenience of the terminal? The transfer.sh service got you covered. Using the good old curl tool, you can share and download shared files using a handful of simple commands. To upload the foo.txt file, run the curl --upload-file ./foo.txt https://transfer.sh/foo.txt command. When the upload is completed, the service returns the download link which you can pass to other users. Downloading the share file is as easy as running the curl https://transfer.sh/SbhMe/foo.txt command (where SbhMe is a unique identifier of the shared file). All shared files automatically expire after two weeks, so there is no need to worry about removing them manually.

If you plan to use the service on a regular basis, add the following function to the ~/.bashrc file:

transfer() {
curl --upload-file $1 https://transfer.sh/$(basename $1);
}
alias transfer=transfer

This way, you can share files using the transfer [FILE] command (e.g., transfer foo.jpg). The project's website provides a few other commands that can be used to share multiple files, combine downloads as tar archives, encrypt files before upload, etc.

comments powered by Disqus

Issue 237/2020

Buy this issue as a PDF

Digital Issue: Price $12.99
(incl. VAT)

News