Generally, 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 application. While the time wasted during these intermediate steps may not seem similar much, information technology keeps on adding up every time you wish to upload or share a file.

Just sharing files doesn't have to be tedious anymore. With the Linux concluding, you lot tin do this in a jiffy. Cheers to tools liketransfer.sh, all it takes is a elementary command on your terminal to upload a file.

What Is Transfer.sh?

Transfer.sh is a free platform that enables like shooting fish in a barrel and fast file sharing via the Linux shell. Uploading a file is equally simple as running a cURL control or a shell office with the file you want to upload equally the parameter. Y'all can also use these commands on Windows 10 past 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 up to 10GB.
  • Files are just stored for 14 days.
  • Optionally encrypt the files with GPG earlier transfer.
  • Limit the number of downloads and days for which the file will be bachelor.

Uploading a File via coil

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

          curl --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 yous want to upload.

Uploading a file via transfer.sh

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

transfer.sh download page

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

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

In the above case, curl renamed the filehello.txt totest.doctor before uploading. On visiting the download link, you'll be prompted to download thetest.md file instead of the original file.

Moreover, you lot can even set 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 gyre command. Here's an example that illustrates this feature:

transfer.sh limiting downloads and days

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

Uploading via Shell Part

Although the scroll control is pretty elementary, you lot can take it a stride further and arrive even easier past creating a shell part. You can then use this trounce function to substitute the whole cURL command with a single word.

To get started, navigate to the /home directory on your Linux automobile and open the.bashrcor.zshrc file depending on the trounce you use. Feel costless to utilize any Linux text editor of your preference. Paste the crush role given below to the stop of the file and save it in one case done.

          transfer(){ if [ $# -eq 0 ];then echo "No arguments specified.
Usage:
transfer <file|directory>
... | transfer <file_name>">&ii;return 1;fi;if tty -s;then file="$1";file_name=$(basename "$file");if [ ! -e "$file" ];then echo "$file: No such file or directory">&two;return 1;fi;if [ -d "$file" ];and then file_name="$file_name.zero" ,;(cd "$file"&&zip -r -q - .)|curl --progress-bar --upload-file "-" "https://transfer.sh/$file_name"|tee /dev/null,;else cat "$file"|curl --progress-bar --upload-file "-" "https://transfer.sh/$file_name"|tee /dev/zippo;fi;else file_name=$ane;coil --progress-bar --upload-file "-" "https://transfer.sh/$file_name"|tee /dev/null;fi;}

For the shell function to work, y'all volition have to close the existing terminal instances and start a new one. Alternatively, y'all can runsource ~/.bashrc if y'all utilize the bash shell, orsource ~/.zshrc if you employ the Z shell. Now, y'all can upload files using thetransfer command from your Linux terminal.

Shell function for transfer.sh

File Sharing Made Piece of cake on Linux

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

For longer-lasting personal storage, you tin lean towards cloud storage providers. Don't worry. Many cloud service providers offer a gratis tier that you can use to determine whether you want to make the purchase.

The All-time 5 Linux Cloud Storage Solutions in 2021

Read Adjacent

About The Writer