Ever stuck on a remote server with some file? Needed to upload/download file from remote server? Find FTP clients tedious for a simple file upload/download? Keep reading for one stop solution to all these problems.
Many a times I fall in situation where I have to deal with remote servers and just to upload a file I have to open FTP clients and have to leave command line for such a simple task. I always wondered if, there was a command line way of doing simple FTP stuffs. Then few weeks ago I came across transfer.sh.
As the name suggests, it is a minimalist command line based file sharing service. You do not need to install anything to get started as it uses just the curl command of Linux. It is very straight forward to use.
You need to specify your file name as follows
curl --upload-file your_file_name https://transfer.sh/
That’s it! Now, you get your file URL right in the command line. Which can be used to download the file or simple view it online.
Once you have uploaded the file downloading is like using your normal curl command.
curl https://transfer.sh/your_file_uri -o local_file_name
local_file_name indicates the name you want the file to be saved as on you local machine.
Now that you know how simple it is to use this, lets see what all features does it provide.
As the URL is public and you might not want the intruders to check your file if they know the URL somehow, you can encrypt and upload the files to ensure that file is password protected and can be opened only by the person knowing the password. We use gpg for encryption.
cat your_filename -ac -o-|curl -X --upload-file "-" https://transfer.sh
Download it using gpg and enter password to open the file.
curl https://transfer.sh/you_file_uri|gpg -o- > local_file_name
Also there is 10 GB file limit, which makes large file uploading a breeze.
Multiple File Uploading
You can also upload multiple files at once. This can be done as follows:
curl -i -F filedata=@your_file_name1 -F filedata=@your_file_name2 https://transfer.sh/
Now downloading is each one is tedious so transfer.sh suggests we use following format to download all at once in .tar or .zip .
curl https://transfer.sh/(your_file_uri_1, your_file_uri_2).zip
If you want it be in .tar format just replace .zip by .tar.gz and you are good to go.
You can also check for malware before uploading.
$ wget http://www.eicar.org/download/eicar.com $ curl -X PUT — upload-file ./eicar.com https://transfer.sh/eicar.com/scan
There are many more such functionalities which people invented themselves after using this tool. Use it to save time and also to not leave commandline.
Did you know how to run a server in background ?
just append & to you normal command that you use to run your server. For instance for JS apps you can use:
yarn start &
This will run your app in the background.