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

But sharing files doesn't have to be irksome anymore. With the Linux last, you lot can practise this in a jiffy. Thanks to tools similartransfer.sh, all it takes is a uncomplicated command on your last to upload a file.

What Is Transfer.sh?

Transfer.sh is a gratuitous platform that enables like shooting fish in a barrel and fast file sharing via the Linux beat out. Uploading a file is as simple as running a cURL command or a shell role with the file you want to upload every bit the parameter. You tin likewise use these commands on Windows x by running a Linux bash vanquish on it.

Here are some meaning features that transfer.sh offers:

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

Uploading a File via cURL

Client URL (curl) is a command-line tool used for transferring data to and from a server, using various network protocols. Uploading a file via whorl and transfer.sh is a straightforward procedure. All you lot have to practise is open your Linux concluding and use the post-obit syntax to upload a file:

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

In the above command, make sure to replace<path-to-file>with the bodily path of the file you want to upload.

Uploading a file via transfer.sh

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

transfer.sh download page

You lot can tweak the above command to change the name and extension of the uploaded file in this manner:

          scroll --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 filehi.txt totest.md before uploading. On visiting the download link, you lot'll be prompted to download thetest.doc file instead of the original file.

Moreover, you tin fifty-fifty set up the maximum number of downloads immune and the maximum number of days for which the file volition be downloadable past adding some headers to the cURL command. Hither's 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. Yous can modify the value subsequently the colons as per your requirements.

Uploading via Shell Function

Although the gyre command is pretty uncomplicated, you lot can take it a step further and make it even easier by creating a shell function. Y'all can and so use this shell part to substitute the whole curlicue control with a single word.

To become started, navigate to the /home directory on your Linux machine and open the.bashrcor.zshrc file depending on the shell you use. Experience gratis to utilize whatsoever Linux text editor of your preference. Paste the beat office given beneath to the end of the file and save it once done.

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

For the crush function to work, you will accept to shut the existing concluding instances and get-go a new one. Alternatively, y'all can runsource ~/.bashrc if you employ the bash shell, orsource ~/.zshrc if you use the Z beat out. Now, you lot 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 cracking utility for obtaining a sharable download URL for your files, it 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 can lean towards cloud storage providers. Don't worry. Many cloud service providers offer a gratuitous tier that you can use to decide whether you want to brand the purchase.

The All-time 5 Linux Cloud Storage Solutions in 2021

Read Next

About The Author