What you need for this guide
- A headless linux machine. This guide is intended for a debian-based system but may work on other distros.
- Glance over the Dropbox linux install guide to get the jist of what we will do.
- Decide if you need the x86 or x64 version based on your processor type.
How to set up dropboxAt the command line, you will run one of the two commands, based on your processor,
cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86" | tar xzf -
cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -
When it's done installing, we're going to want to initialize it,
which will give us the following output
This computer isn't linked to any Dropbox account...
Please visit https://www.dropbox.com/cli_link_nonce?nonce=3f815ada4c4842c2aa7de9239072532e to link this device.
Copy the link (your link, not mine) and paste it to your browser, leave the command running during this process. When it's linked, you should see the following output (where ____ is the name on your account),
This computer is now linked to Dropbox. Welcome ____.
Now, we're linked to Dropbox but we still want a way to control it easily. We're going to want to download the python script, we'll put it in the same installation folder we just created to keep things tidy. (Note, if you don't have python installed, you need to install it now.)
wget -O ~/.dropbox-dist/dropbox.py https://www.dropbox.com/download?dl=packages/dropbox.py
To create a nice shortcut to launch the dropbox script, you can create an alias like so,
alias dropbox='python ~/.dropbox-dist/dropbox.py'
Don't forget to add it to your .bashrc file if you want it to be available next time you log in. With the alias created, we can now access dropbox easily.
Dropbox command-line interface
Note: use dropbox help <command> to view usage for a specific command.
status get current status of the dropboxd
help provide help
puburl get public url of a file in your dropbox
stop stop dropboxd
running return whether dropbox is running
start start dropboxd
filestatus get current sync status of one or more files
ls list directory contents with current sync status
autostart automatically start dropbox at login
exclude ignores/excludes a directory from syncing
lansync enables or disables LAN sync
To kick things off, you begin with
To check on the status, use
Don't be alarmed if the status stays in "Starting" for a long time the first time you run it.
If you have the same dropbox account installed on other machines on your network, you can speed up your sync and decrease your bandwidth usage by letting dropbox sync using the files already on your other machine(s). You can enable lansync like so,
dropbox lansync y
The linux version of dropbox will put all of your files into the following location ~/Dropbox. If you don't want to sync your entire dropbox folder, you can have it exclude folders and files like so,
dropbox exclude add ~/Dropbox/FolderToExclude
If you copy some stuff into your dropbox and you're waiting to see if it's ready yet, you can execute the following command,
watch -n 30 python ~/.dropbox-dist/dropbox.py status
This will output your dropbox status every 30 seconds and will show "Up to date" when you are synched.