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 fourth dimension wasted during these intermediate steps may not seem like much, it keeps on calculation upwardly every fourth dimension yous wish to upload or share a file.

But sharing files doesn't take to be irksome anymore. With the Linux concluding, you tin can do this in a jiffy. Thanks to tools similartransfer.sh, all information technology takes is a unproblematic command 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 crush. Uploading a file is as uncomplicated as running a cURL command or a shell function with the file you want to upload every bit the parameter. You can also use these commands on Windows 10 by running a Linux bash beat on it.

Here are some meaning features that transfer.sh offers:

  • Requires no GUI, uses the control line.
  • Upload files with sizes up to 10GB.
  • Files are just stored for xiv days.
  • Optionally encrypt the files with GPG before transfer.
  • Limit the number of downloads and days for which the file volition be available.

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 cURL and transfer.sh is a straightforward process. All yous have to do is open upwards your Linux terminal and use the following syntax to upload a file:

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

In the above command, brand sure to supercede<path-to-file>with the actual path of the file you desire to upload.

Uploading a file via transfer.sh

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

transfer.sh download page

You can tweak the higher up command to modify 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 to a higher place example, cURL renamed the filehello.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, you can even set the maximum number of downloads immune and the maximum number of days for which the file will be downloadable by adding some headers to the cURL command. Hither's an example that illustrates this feature:

transfer.sh limiting downloads and days

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

Uploading via Vanquish Role

Although the curlicue command is pretty simple, yous can have it a step further and go far even easier by creating a shell role. Yous can then use this shell function to substitute the whole whorl control with a unmarried word.

To become started, navigate to the /home directory on your Linux machine and open up the.bashrcor.zshrc file depending on the crush you use. Experience costless to utilise any Linux text editor of your preference. Paste the shell role given below to the finish of the file and relieve information technology once washed.

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

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

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 deject storage entirely. It is exceptional for sharing your files temporarily equally it only stores your files for 14 days maximum.

For longer-lasting personal storage, you can lean towards deject storage providers. Don't worry. Many cloud service providers offering a free tier that you can use to decide whether you want to make the purchase.

The Best 5 Linux Cloud Storage Solutions in 2021

Read Side by side

Virtually The Author