More often than not, file sharing involves logging into a storage provider, manually locating the file, and uploading it via the graphical user interface of a web browser or awarding. While the time wasted during these intermediate steps may not seem like much, information technology keeps on adding up every time you wish to upload or share a file.

But sharing files doesn't have to be tedious anymore. With the Linux terminal, you lot tin can do this in a jiffy. Thanks to tools liketransfer.sh, all it takes is a simple control on your terminal to upload a file.

What Is Transfer.sh?

Transfer.sh is a free platform that enables easy and fast file sharing via the Linux beat out. Uploading a file is equally simple as running a cURL command or a beat out function with the file you want to upload as the parameter. You can as well employ these commands on Windows ten by running a Linux bash shell on it.

Here are some significant features that transfer.sh offers:

  • Requires no GUI, uses the command line.
  • Upload files with sizes upwardly to 10GB.
  • Files are only stored for fourteen days.
  • Optionally encrypt the files with GPG before transfer.
  • Limit the number of downloads and days for which the file will be available.

Uploading a File via cURL

Client URL (cURL) is a control-line tool used for transferring data to and from a server, using various network protocols. Uploading a file via cURL and transfer.sh is a straightforward process. All y'all accept to do is open up up your Linux terminal and use the post-obit syntax to upload a file:

          gyre --upload-file <path-to-file> https://transfer.sh        

In the to a higher place command, make sure to replace<path-to-file>with the actual path of the file you want to upload.

Uploading a file via transfer.sh

On running the control, you'll get a URL that you tin can share with other people for them to download your uploaded file.

transfer.sh download page

You can tweak the to a higher place control to change the name and extension of the uploaded file in this manner:

          curl --upload-file <path-to-file> https://transfer.sh/<file_name.extension>        
Uploading a file with different name and extension

In the above instance, cURL renamed the filehello.txt totest.doc earlier uploading. On visiting the download link, you'll be prompted to download thetest.md file instead of the original file.

Moreover, you can even prepare the maximum number of downloads allowed and the maximum number of days for which the file will be downloadable by adding some headers to the cURL control. Hither's an case that illustrates this feature:

transfer.sh limiting downloads and days

Hither, the curlicue command consists of 2 HTTP headers:Max-Downloads andMax-Days. You tin alter the value after the colons as per your requirements.

Uploading via Shell Role

Although the cURL command is pretty simple, you can take it a step farther and make information technology even easier by creating a shell function. You tin can and so use this shell function to substitute the whole coil control with a unmarried word.

To get started, navigate to the /dwelling house directory on your Linux machine and open the.bashrcor.zshrc file depending on the shell yous use. Feel free to use whatsoever Linux text editor of your preference. Paste the shell role given below to the terminate of the file and save it once done.

          transfer(){ if [ $# -eq 0 ];then echo "No arguments specified.
Usage:
transfer <file|directory>
... | transfer <file_name>">&two;return 1;fi;if tty -due south;then file="$i";file_name=$(basename "$file");if [ ! -e "$file" ];then echo "$file: No such file or directory">&2;render 1;fi;if [ -d "$file" ];so file_name="$file_name.zip" ,;(cd "$file"&&zip -r -q - .)|curl --progress-bar --upload-file "-" "https://transfer.sh/$file_name"|tee /dev/aught,;else cat "$file"|ringlet --progress-bar --upload-file "-" "https://transfer.sh/$file_name"|tee /dev/null;fi;else file_name=$1;curl --progress-bar --upload-file "-" "https://transfer.sh/$file_name"|tee /dev/nada;fi;}

For the crush part to work, yous will have to close the existing concluding instances and beginning a new 1. Alternatively, you can runsource ~/.bashrc if y'all employ the bash beat out, orsource ~/.zshrc if you apply the Z shell. Now, you tin can upload files using thetransfer control from your Linux terminal.

Shell function for transfer.sh

File Sharing Made Easy on Linux

While transfer.sh is a slap-up utility for obtaining a sharable download URL for your files, information technology isn't an alternative for replacing your deject storage entirely. It is exceptional for sharing your files temporarily as it only stores your files for 14 days maximum.

For longer-lasting personal storage, you lot can lean towards deject storage providers. Don't worry. Many cloud service providers offer a free tier that you can utilise to determine whether you desire to make the buy.

The Best 5 Linux Cloud Storage Solutions in 2021

Read Side by side

About The Author