How Do I Upload A File Via Terminal
Make terminal upload file using file.io
"The art of programming is the skill of controlling complexity." – Marijn Haverbeke
I solar day I needed to send some confidential file without signup. I googled about such service available on the net and found file.io.
Co-ordinate to file.io website -
Merely upload a file, share the link, and subsequently it is downloaded, the file is completely deleted. For added security, set an expiration on the file and information technology is deleted within a certain amount of time, even if information technology was never downloaded. All files are encrypted when stored on our servers.
Most of my time goes into striking commands on the terminal. file.io tin be accessed using any browser merely I wanted to take this functionality to the terminal. I browsed that website and found an easy to use API.
At first, I tried to add a command for uploading files using an alias but it didn't work very fine. Then I thought of writing function which will be foolproof and give some errors for helping out the user if they type something wrong.
Earlier going ahead make certain you take curl installed. If you lot are using Ubuntu, do this -
Add the functionality Automatically
Run this control in your terminal.
For bash
For zsh
Add the functionality Manually
Add this to your ~/.bashrc or ~/.zsh file and restart your terminal. I tested this on bash and zsh in Ubuntu eighteen.04 LTS .
Usage
For simple file upload, practise this
I am assuming here that the file name is file.ext.
You tin also fix an expiration period. By default, the expiration is set up to 14 days. Pass 3rd argument for expiration. Y'all tin can write whatsoever positive number followed past west, m or y. w is for weeks, one thousand for months and y for years.
Determination
It is very useful when you have to transport some small sensitive data to some other person. Y'all can be bodacious that the file you lot are sending to some other person will exist deleted after he/she download it. The merely drawback is that you lot can't ship a large file(file_size < 100MB). Try this script on different beat out there and if you discover any bug delight let me know.
Source: http://amanroy.me/upload-file-from-terminal
Posted by: walleronvalcor.blogspot.com
0 Response to "How Do I Upload A File Via Terminal"
Post a Comment