A cool way of file sharing from console

To all geeks ( both Mac and Linux) who works a lot in console and with remote servers, most probably used a lot scp for sending files to the server and back. Sometimes, you have to connect to jump server before getting to needed machine for security reasons and that's why i would like to share with you a nice alternative - it's called transfer.sh
You can use it with your browser and simply drag files into it to share with other people , but you can also upload\download your files from console !
Here's an easy example of how to file upload from command line :

curl --upload-file ./hello.txt https://transfer.sh/hello.txt

To download this file you just need to run

curl https://transfer.sh/66nb8/hello.txt

Of course you can make a funtion and add alias to your .swiftrc file :

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

Personally, i prefer to store functions in separate .functions file and then just load it in my .zshrc file (people who don't use ohmyzsh can load functions file in .swiftrc) like this :

for file in ~/.{functions}; do
    [ -r "$file" ] && source "$file"
done
unset file

Now, let's get back to transfer.sh :

  • You can upload multiple files like this :
curl -i -F filedata=@/tmp/hello.txt -F filedata=@/tmp/hello2.txt https://transfer.sh/
  • You can combine downloads into tar archives :
curl https://transfer.sh/(15HKz/hello.txt,15HKz/hello.txt).tar.gz

#or 

curl https://transfer.sh/(15HKz/hello.txt,15HKz/hello.txt).tar

#or 

curl https://transfer.sh/(15HKz/hello.txt,15HKz/hello.txt).zip
  • You can send files securely with gpg
#Encrypt & upload
cat /tmp/hello.txt|gpg -ac -o-|curl -X PUT --upload-file 
"-" https://transfer.sh/test.txt
#Decrypt & download
curl https://transfer.sh/1lDau/test.txt|gpg -o- > /tmp/hello.txt

So, as you can see - it can be really handy sometimes to use this tool instead of scp.

Enjoy :)