Share files from command line with transfer.sh: a simple cheatsheet
Transfer.sh is a website that helps users to share files from the command-line an efficient way.
It won’t required any additional software to work except cURL.
If your linux distribution doesn’t have cUrl (unlikely!), you can install it with
`sudo apt install curl`
The service is free and allows users to upload files up to 10 GB, that are deleted automatically from server after 14 days.
Here a brief cheatsheet.
Upload
$ curl --upload-file ./hello.txt hello.txt
Encrypt & upload
$ cat /tmp/hello.txt|gpg -ac -o-|curl -X PUT --upload-file "-" test.txt
Download & decrypt
$ curl 1lDau/test.txt|gpg -o- > /tmp/hello.txt
Upload and check with virustotal
$ curl -X PUT --upload-file nhgbhhj test.txt/virustotal
Bash/Zsh alias
Add to .bashrc or .zshrc:
transfer() {
# write to output to tmpfile because of progress bar
tmpfile=$( mktemp -t transferXXX )
curl --progress-bar --upload-file $1 $(basename $1) >> $tmpfile;
cat $tmpfile;
rm -f $tmpfile;
}
alias transfer=transfer
Usage:
$ transfer test.txt