Technology Blog

How to sync your documents with Google Drive on Ubuntu


Google Drive is a popular online service that allows for the easy sharing and collaborative editing of documents (word files or spreadsheets). Under the most usual day to day circumstances, the GDrive tool is very useful serving as a cloud space and/or a readily available online collaboration platform. On this guide, we will see how you can install an open source client tool for the service named Grive, and how to set it up according to your needs.

Grive Installation

The Grive client can be downloaded as a source or as a deb package from the official website. Ubuntu users can use the corresponding webupd8 repository by adding it on their system at their own risk. To do so, type the following commands on a terminal:

sudo apt-add-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install grive

This will install the software in your system and if done right, you should be able to run it from the terminal. Type “grive –help” as a start to get an overview of what the Grive tool can do for you.

grive –help

Setting Up Grive

First, navigate to the folder that you want to sync with the GDrive service. You may also create a new folder for that purpose if you want.

The next thing that you’ll need to do is to authenticate your Google account and allow the software to interact with the online service. This is done by typing “grive -a” on the terminal.

grive -a

Running: grive -a

This command will generate a unique link on the terminal which you can press and it will open in your default browser. The webpage that the link leads to should contain a 40-digit code that you may copy and paste on the terminal again. Upon pressing the enter button, Grive will start uploading the documents contained on the location that you had navigated through the terminal beforehand. This will auto-create the folders with the same structure as found in your local hard drive.

Running Grive

After this step is done, you will not have to authenticate again to sync your files with Google Drive. Just navigate to the folder that contains the files you want to sync with your GDrive account and enter the command: “grive sync”.

grive sync

To avoid mistakes or large waiting periods for the uploading of many more files that originally anticipated, you can always pre-check what Grive is going to sync by using the following command: “grive –dry-run”.

grive –dry-run

This will only display what will be copied, without actually doing the job.

Although Grive is currently at a very early stage of development (version 0.4), it works fine as far as syncing goes. More options would of course be very welcome, and the same goes for the GUI design which is currently somewhat “poor” (in options) and more importantly it is developed and offered unofficially by a different team. You can, however, check it out by installing this extra repository as well.