Transfer.sh is a website and not a script, which helps users to share files from the command-line in an efficient way. It won’t required any additional software to work except pre-installed application such as wget or cURL. By default wget and cURL was installed in most of the distribution so we don’t need to install these.
Many GUI & CLI based utilities and websites are there to share files over Internet. Today we are going to show you about Transfer.sh, its simple and fast way to share files from the command-line. It might be very useful for NIX guys, whoever stick with command-line most of the times instead of GUI.
The service is absolutely free, it allows users to upload files up to 10 GB, you can upload single or group of files in one shot. You have a option to encrypt files before uploading, all files will be deleted automatically from server after 14 days.
Transfer.sh support currently the s3 (Amazon S3) provider and local file system (local). This code is free to use, so you can explore Transfer.sh on your own server environment by modifying few settings.
Transfer.sh Features
- Share uploaded files with a URL
- Free to Upload up to 10 GB
- Files stored for 14 days
- Option to Encrypt your files
- Maximize amount of downloads
- The service is completely free
How to Upload/Download files from Command Line using transfer.sh
Transfer.sh helps users to share files over internet to anyone from command-line. Use the following format and mention the exact file location. After successful file upload, Transfer.sh will generate a unique URL for downloading.
$ curl --upload-file /home/magi/Documents/mono.txt https://transfer.sh/mono.txt https://transfer.sh/7hcBa/uber-cli.txt
For Multiple file upload, use the following format. After successful files upload, Transfer.sh will generate separate unique URL for each file for downloading.
$ curl -i -F filedata=@/home/magi/Documents/uber-cli.txt -F filedata=@/home/magi/Documents/taskwarrior.txt https://transfer.sh/ HTTP/1.1 100 Continue HTTP/1.1 200 OK Date: Mon, 08 May 2017 14:12:18 GMT Content-Type: text/plain Content-Length: 79 Connection: keep-alive Server: Transfer.sh HTTP Server 1.0 X-Made-With: <3 by DutchCoders X-Served-By: Proudly served by DutchCoders https://transfer.sh/Oughc/uber-cli.txt https://transfer.sh/Oughc/taskwarrior.txt
Alternatively you can upload the files through Transfer.sh web page by drag & drop the file on it. I’m going to drag the file name called free-cmd-example.txt
.
For Download, use the generated unique link and followed by filename which you want to save.
$ curl https://transfer.sh/Oughc/uber-cli.txt -o /home/magi/uber-cli.txt % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 11877 100 11877 0 0 10481 0 0:00:01 0:00:01 --:--:-- 10482
Alternatively you can download the files from the web by entering the unique URL on web browser.
How to Encrypt & Upload/Download files from command line using transfer.sh
If you want to share the files in a secure way, I would advise you to encrypt the files before upload using following format. It will prompt to enter the password twice when you use encryption.
$ cat /home/magi/Documents/ubuntu-post-install.txt|gpg -ac -o-|curl -X PUT --upload-file "-" https://transfer.sh/ubuntu-post-install.txt https://transfer.sh/2BelF/ubuntu-post-install.txt
For Download, use the generated unique URL and followed by output filename & location which you want to save.
$ curl https://transfer.sh/2BelF/ubuntu-post-install.txt|gpg -o- > /home/magi/ubuntu-post-install.txt % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1191 100 1191 0 0 1202 0 --:--:-- --:--:-- --:--:-- 1201 gpg: AES encrypted data gpg: encrypted with 1 passphrase
Alternatively you can download the files from the web by entering the unique URL on web browser.
Add alias for easy/frequent access
You may get frustrated by using the full format and some time you will forget. So, add a alias to .bashrc or .zshrc
and make the things more simple.
I’m using BASH shell, so adding following lines into end of the .bashrc
file. Then save and close the file.
$ nano ~/.bashrc transfer() { # write to output to tmpfile because of progress bar tmpfile=$( mktemp -t transferXXX ) curl --progress-bar --upload-file $1 https://transfer.sh/$(basename $1) >> $tmpfile; cat $tmpfile; rm -f $tmpfile; } alias transfer=transfer
Run the following command to take effect the above change.
$ source ~/.bashrc
Now simply upload the files using transfer
command followed by filename which you want to upload.
$ transfer /home/magi/Desktop/emerald-icon-theme.txt ######################################################################## 100.0% https://transfer.sh/SFk4B/emerald-icon-theme.txt
There are quite a few similar services available in Internet like PSiTransfer, chunk.io, up.depado.eu, etc.
Invaluable tip about transfer.sh, I didn’t know about it: thank you so much, Magesh ! I bumped into your site through Linux Today, and now I’m gonna start following your RSS feed.
Glad to hear, thank you so much to following us on RSS feed.