How to use Dropbox from command line to upload a file to public folder and find its public URL…

Dropbox is a free service that lets you to share and collaborate files with others. In this, public as well as private sharing is possible. It has cross platform client which helps you to sync files in different OS including mobile phones. For sharing files publicly, we need to copy the files to public folder. Instead of copying, we can use the following script. This will return the public URL which is used to share the file. We don’t need to visit the Dropbox website any more for getting public sharing URL of the file. Follow this procedure for trying out this tip.. First we need to install Dropbox. This tutorial assumed that you have already installed the Linux Dropbox client and configured by entering your username and password. If you have not installed, go to this page and download or use your package manager to install or use following command in your terminal (for Debian based OS), configure it by entering your username and password. Then select your directory for sharing. Type following command in your terminal.

sudo apt-get install socat xclip

Now download this script. Now open the terminal, use cd command to go to the downloaded directory. Enter following command in the terminal.

sudo chmod +x drop

“drop” is the file name. If your file name is different, change accordingly. Now enter following command to the terminal. It copies the file to /usr/bin folder. So we can access this file from any folder.

sudo mv drop /usr/bin/

Everything is ready. Now test the script by entering

drop filename1 filename2

Replace file name with your files. It will return public url of each file by copying to public directory. Script source:

Share this article