How to Upload Zip File to Terminal
Mostly, 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 time wasted during these intermediate steps may not seem like much, it 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 last, you tin can do this in a jiffy. Thanks to tools similartransfer.sh, all it takes is a simple control on your terminal to upload a file.
What Is Transfer.sh?
Transfer.sh is a costless platform that enables easy and fast file sharing via the Linux shell. Uploading a file is every bit simple every bit running a gyre control or a trounce function with the file you want to upload as the parameter. You tin also 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 up 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 available.
Uploading a File via roll
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 procedure. All you accept to practice is open up your Linux terminal and use the following syntax to upload a file:
whorl --upload-file <path-to-file> https://transfer.sh
In the higher up command, make sure to supervene upon<path-to-file>with the actual path of the file you want to upload.
On running the control, yous'll get a URL that you tin share with other people for them to download your uploaded file.
You can tweak the above command to change the name and extension of the uploaded file in this manner:
coil --upload-file <path-to-file> https://transfer.sh/<file_name.extension>
In the higher up case, ringlet renamed the filehello.txt totest.md 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 exist downloadable past calculation some headers to the cURL command. Here's an example that illustrates this feature:
Hither, the cURL control consists of 2 HTTP headers:Max-Downloads andMax-Days. You can change the value after the colons equally per your requirements.
Uploading via Shell Part
Although the cURL command is pretty simple, you tin take it a stride farther and brand it fifty-fifty easier past creating a vanquish role. Yous can then use this shell function to substitute the whole gyre command with a single word.
To get started, navigate to the /dwelling house directory on your Linux machine and open up the.bashrcor.zshrc file depending on the beat you lot use. Feel free to utilize any Linux text editor of your preference. Paste the shell function given below to the end of the file and save it in one case done.
transfer(){ if [ $# -eq 0 ];so echo "No arguments specified.
Usage:
transfer <file|directory>
... | transfer <file_name>">ⅈreturn i;fi;if tty -s;and then file="$one";file_name=$(basename "$file");if [ ! -e "$file" ];then repeat "$file: No such file or directory">&2;return 1;fi;if [ -d "$file" ];and so file_name="$file_name.goose egg" ,;(cd "$file"&&zip -r -q - .)|curl --progress-bar --upload-file "-" "https://transfer.sh/$file_name"|tee /dev/naught,;else true cat "$file"|curl --progress-bar --upload-file "-" "https://transfer.sh/$file_name"|tee /dev/null;fi;else file_name=$1;whorl --progress-bar --upload-file "-" "https://transfer.sh/$file_name"|tee /dev/aught;fi;}
For the beat out function to piece of work, you will have to shut the existing terminal instances and outset a new 1. Alternatively, yous can runsource ~/.bashrc if you utilise the bash shell, orsource ~/.zshrc if you utilise the Z trounce. At present, you can upload files using thetransfer command from your Linux terminal.
File Sharing Fabricated Piece of cake on Linux
While transfer.sh is a not bad utility for obtaining a sharable download URL for your files, it 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 can lean towards deject storage providers. Don't worry. Many cloud service providers offer a gratis tier that you can use to decide whether yous desire to brand the purchase.
About The Author
mickelsonficiones.blogspot.com
Source: https://www.makeuseof.com/upload-and-share-files-from-terminal-using-transfer-sh/
Post a Comment for "How to Upload Zip File to Terminal"