This tutorial explains how to upload and share files from the command line.
transfer.sh is a free website that helps to upload and share files (text file, image file, etc.) from the command line. You can upload multiple files to this website, and in return, it will provide you a unique URL to that file. Using that URL and with a simple command, you/your friend can easily download that file directly from the command line.
This file sharing from the command line is made possible by this website and with a popular library and command line tool ‘cURL’ or simply curl. Whether you are using Windows operating system, Linux, etc., you can upload and share files with your friends right from the command line. If you want, you can also use its web version for sharing files.
You can upload up to 5 GB files, but upload limit for a single file is not specified. All your uploaded files remain on servers for 14 days and then files are deleted automatically.
In the screenshot above, you can see the homepage of this website.
How To Share Files from Command Line?
Before you proceed to share files from the command line, make sure that Visual C++ 2008 is installed on your PC. After this, follow these steps:
Step 1: Install cURL on your PC (Windows). You can use this link to download zip file with correct version of cURL (32 or 64-bit) for your PC. For other operating systems, this library might be installed already. If not, the same link can be used for downloading cURL library for any other operating system.
Step 2: After downloading the zip file, extract it. Then you will get ‘curl exe file‘ and ‘two dll files‘ (libeay32.dll and ssleay32.dll). See the screenshot below:
Step 3: Copy all three files and paste those files in ‘System32’ folder (default location is C:\Windows\System32).
Step 4: You also have to add new and valid copy of security certificate (CERT) which you can get from here. The certificate file will open in a web browser, which you can copy and paste in Notepad. After that, save that file as curl-ca-bundle.crt file.
After this, copy this file, and paste it in same System32 folder.
Step 5: Open command prompt window and check if curl library is successfully added to your system or not. Type ‘curl’ and press enter. If no error will come, cURL is installed successfully. You will find a message, like visible in screenshot below:
Now you can share files from command line.
Step 6: To upload a file to transfer.sh website’s server, you need to type ‘curl’ ‘- -upload-file’ ‘source location of file that you want to upload’ and https://transfer.sh/filename with extension. Command will be like:
Based on the file size, your file will be uploaded to server. As soon as the file is uploaded successfully, you will get uploaded file’s URL in command prompt window, as visible in the screenshot above.
Step 7: Now you have the file URL which you can give to your friend or can use for yourself. To download the uploaded file, command would be like: ‘curl’ ‘uploaded file URL’ ‘-o’ ‘destination location’ to save the file. Here, -o is mandatory otherwise command will not work. See the screenshot below:
You will also be able to see the download progress in real-time right from the command prompt window. Once the file is downloaded completely, you can open destination location to use that file.
Apart from using these commands, there are multiple other commands can also be used, like: upload multiple files, encrypt files, combine downloads as zip file etc. You can open homepage of transfer.sh website to get a hint about usage of those commands.
Share Files using Web Version of Transfer.sh:
Web version of this website is straightforward and quite simple to use. All you have to do is drop file(s) from your PC to the required place on its homepage and it will start uploading your file. Once the file is uploaded completely, file URL will be in front of you.
Copy that URL and share with required persons.
Sharing files using command line is quite unique and valuable feature that can be very useful for Linux users, and other users. Another benefit is that no browser is needed to upload and share files. Simply your commands and command prompt window is required to upload and share files.