
In this simple tutorial, we are going to upload files directly from the terminal to transfer.sh, a free cloud where you can share an url encrypted with your files. I’m going to be using Ubuntu server.
First I’m going to select the file, for this tutorial I created a new txt file and filled with a message:
$ touch hello.txt
$ nano hello.txt
#On nano
This is a sample file to upload to transfer.sh
Now that we have selected our file to upload, we are going to type:
$ curl --upload-file "file" https://transfer.sh/"file name"
Like this:
$ curl --upload-file ./hello.txt https://transfer.sh/hello.txt
Transfer.sh should give us an url to download the file:
https://transfer.sh/zFLFp3/hello.txt

Encrypt before upload, multiple uploads and set deletion time
You can encrypt your files before upload, typing:
cat /path/to/file/hello.txt|gpg -ac -o- | curl -X PUT --upload-file "-" https://transfer.sh/hello.txt
When I tried, it appears an error saying:
gpg: problem with the agent: Inappropriate ioctl for device
gpg: error creating passphrase: Operation cancelled
gpg: symmetric encryption of ‘[stdin]’ failed: Operation cancelled
Could not upload empty file
This happens because GPG is confused where to read input from and I’m currently connected via ssh. We need to configure it to look for input from tty:
$ export GPG_TTY=$(tty)
Then we can try again, GPG is going to ask us for a paraphrase to encrypt, and then is going to upload to transfer.sh

To upload multiple files, we are going to type:
$ curl -i -F filedata=@/path/to/hello.txt -F filedata=@/path/to/another_hello.txt https://transfer.sh/
Like this:
matiasm@servidor-casa:~$ curl -i -F filedata=@./hello.txt -F filedata=@./another_hello.txt https://transfer.sh
HTTP/2 200
server: nginx/1.14.2
date: Thu, 03 Feb 2022 14:46:59 GMT
content-type: text/plain
content-length: 80
retry-after: Thu, 03 Feb 2022 15:47:02 GMT
x-made-with: <3 by DutchCoders
x-ratelimit-key: 127.0.0.1,191.82.86.72,191.82.86.72
x-ratelimit-limit: 10
x-ratelimit-rate: 600
x-ratelimit-remaining: 9
x-ratelimit-reset: 1643899622
x-served-by: Proudly served by DutchCoders
strict-transport-security: max-age=63072000
https://transfer.sh/Uc3Vu2/hello.txt https://transfer.sh/Uc3Vu2/another_hello.txt
If we need, we can set a deletion time simple adding ‘-H “Max-Days: 1” ‘
$ curl --upload-file ./hello.txt https://transfer.sh/hello.txt -H "Max-Days: 1"
Downloading files from terminal
If we want to download the files from the terminal, simply do:
$ curl https://transfer.sh/Uc3Vu2/hello.txt
Download and decrypt:
$ curl https://transfer.sh/Uc3Vu2/hello.txt|gpg -o- > /tmp/hello.txt $ cat /tmp/hello.txt
Pingback: Your own VPN, secure and ads-free! – the admin notes
Pingback: Networking with Linux: commands, services and more – the admin notes