By and large, file sharing involves logging into a storage provider, manually locating the file, and uploading it via the graphical user interface of a spider web browser or application. While the fourth dimension wasted during these intermediate steps may not seem like much, it keeps on adding upwards every time you wish to upload or share a file.

Merely sharing files doesn't have to be deadening anymore. With the Linux final, you tin can exercise this in a jiffy. Thank you 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 piece of cake and fast file sharing via the Linux beat out. Uploading a file is equally uncomplicated as running a cURL command or a shell function with the file you desire to upload every bit the parameter. Y'all tin also utilize these commands on Windows ten past running a Linux bash shell on information technology.

Here are some significant features that transfer.sh offers:

  • Requires no GUI, uses the command line.
  • Upload files with sizes upwards 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 coil

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 you accept to do is open up your Linux terminal and use the following syntax to upload a file:

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

In the above command, brand sure to replace<path-to-file>with the actual path of the file yous want to upload.

Uploading a file via transfer.sh

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

transfer.sh download page

You tin can tweak the above command to change the proper noun and extension of the uploaded file in this manner:

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

In the in a higher place example, curlicue renamed the filehowdy.txt totest.md before uploading. On visiting the download link, you'll be prompted to download thetest.medico file instead of the original file.

Moreover, y'all tin can even set up 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 ringlet command. Here'south an instance that illustrates this feature:

transfer.sh limiting downloads and days

Here, the cURL command consists of 2 HTTP headers:Max-Downloads andMax-Days. You tin change the value afterwards the colons as per your requirements.

Uploading via Shell Function

Although the roll command is pretty unproblematic, you can take it a step further and brand information technology even easier by creating a shell function. You tin can then use this crush function to substitute the whole cURL control with a unmarried word.

To go started, navigate to the /habitation directory on your Linux machine and open the.bashrcor.zshrc file depending on the shell you lot use. Feel costless to use whatsoever Linux text editor of your preference. Paste the crush part given below to the end of the file and salve it one time washed.

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

For the shell role to work, y'all volition take to close the existing terminal instances and start a new ane. Alternatively, you can runsource ~/.bashrc if yous use the fustigate shell, orsource ~/.zshrc if you lot apply the Z shell. Now, yous can upload files using thetransfer command from your Linux terminal.

Shell function for transfer.sh

File Sharing Made Easy on Linux

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

For longer-lasting personal storage, you tin can lean towards cloud storage providers. Don't worry. Many deject service providers offer a complimentary tier that yous can use to make up one's mind whether yous want to make the purchase.

The Best 5 Linux Deject Storage Solutions in 2021

Read Side by side

Virtually The Author