How to Access And Sync Google Drive In Ubuntu

After much waiting, Google finally released the Google Drive last month. Together with the launch, Google also released desktop apps for the Windows and Mac OS. As for Linux users, once again, there is no love for you (yet). At the moment, you will have to use the web interface for downloading and uploading files. While many of us are patiently (or perhaps, impatiently) waiting for the official desktop sync client to arrive, there is a third party app, called Grive, that brings Google Drive synchronization to your desktop. It is a command-line based app, but the usage is easy and basic synchronization works fine. Let’s check out how you can access and sync Google Drive in Ubuntu.

Grive is a new project and it is not found in the Ubuntu repository. The most direct, though not the easiest, way to get Grive is to download the source code, compile and install it. Alternatively, an easier way is to use a third-party PPA that has added the Grive package into it. Here’s the PPA:

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

1. Open your Nautilus File Manager and create a new folder and name it “gDrive” (or whatever name you want) in the Home directory.

2. Open a terminal and cd to the gDrive folder

cd gDrive

3. Run the grive configuration

grive -a

You should see the a long long URL in the terminal. Right click on it and select “Copy Link Address”.

grive-copy-link-address

4. Open a browser and paste the URL to the address bar (and press Enter). At the Google page, you need to grant access to Grive. Click “Allow Access”.

grive-allow-access

Once you allow access to Grive, it will show the authentication code which you need to copy and paste back to the terminal.

grive-authentication-code

5. Copy the authentication code and return to the terminal. Paste (using Ctrl + Shift + v) the code to the terminal and press Enter. Once it is authenticated, Grive will start to sync the gDrive folder and your Google Drive account.

6. For all future sync, you just have to run the command:

grive

in the gDrive folder. Note that you only have to use the “-a” parameter once. All future sync can be done without the “-a” parameter.

The current version of Grive doesn’t run as a background service to automatically sync your files. You will have to do it manually to perform the sync. One easy way to overcome this limitation is to create a cron job that runs the grive command at regular interval.

Here is how it can be done:

1. Open a terminal and type:

crontab -e

If prompted, select ‘2’ for nano editor.

Scroll down to the end of the file and on a new line, enter the following command:

*/15 * * * * cd /home/damien/gDrive && grive

Save (Ctrl + o) and exit (Ctrl + x).

The above crontab will run the “grive” command in the gDrive folder every 15 minutes. You can change the time frequency and the file path to your own gDrive folder.

That’s it.