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.

Share this page:

9 Comment(s)

Add comment

Comments

From: jelabarre59

The one disadvantage of all the current sync utilities for Google Drive is there's no way do do backups of Google Docs.  I've been using it as a central place to keep stories I'm working on, so I can use my tablet *or* whatever computer I'm using to do my writing.  Not necessarily looking for a full "sync" either, more something where daily I could say to save a local copy.  Would hate to lose my space epic because someone pulled the wrong cable at Google, and having to remember to export manually means I often forget.

From: Jonathan

Hmm.. after installing,  when I do:

grive –help

 

I get:

 

grive: /home/jonathan/grive/grive2/libgrive/src/json/ValBuilder.cc:133: gr::Val gr::ValBuilder::Result() const: Assertion `m_ctx.size() == 1U' failed.

From: Jonahtan

I getthe same error:

grive: /home/jonathan/grive/grive2/libgrive/src/json/ValBuilder.cc:133: gr::Val gr::ValBuilder::Result() const: Assertion `m_ctx.size() == 1U' failed.Aborted

when I enter my validation code.

From: jean-Charles

It is important to specify the folder first

From: ofer barsadeh

trying to sync. get:

json_tokener_errors' has different size in shared object, consider re-linking

From: Igor

 Hi. When I do grive sync files don't remove from google drive. Why?

From: Charles D.

 So, I have it running from the webupd8 repository, and successfully syncing.Now, that said, this appears to be a static utility that I have to go to the cmd line and enter "grive sync" to download/upload any changes w/ my local folder or on the Google drive.

That said, I am guessing if we want this to run in the background, we can do an etc/init.d or rc.d script for running in the background upon boot time...how do I get it to run either as a service of embed it as a process?...or do I need to do a cron job that runs every 5mins or so on the root directory?

From: nontonfilm.inf

why Error accessing 

Error accessing ./.wine/dosdevices/z:/sys/bus/cpu/devices/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/firmware_node/subsystem/devices/device:02/PNP0303:00/subsystem/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/device:02/PNP0F13:00/subsystem/devices/device:0c: Too many levels of symbolic links; skipping file

Error accessing ./.wine/dosdevices/z:/sys/bus/cpu/devices/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/firmware_node/subsystem/devices/device:02/PNP0303:00/subsystem/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/device:02/PNP0F13:00/subsystem/devices/device:0d: Too many levels of symbolic links; skipping file

 

From: Jonathan

I've been using Grive successfully for a year now and all of a sudden I'm getting this erro again.

grive: /home/jonathan/grive/grive2/libgrive/src/json/ValBuilder.cc:133: gr::Val gr::ValBuilder::Result() const: Assertion `m_ctx.size() == 1U' failed.

Aborted