1. Home
  2. Linux
  3. Access google drive on linux

How To Access Google Drive On Linux

There are many different solutions for cloud-based internet storage these days. There’s the infamous Dropbox, Box.com, Microsoft’s OneDrive, and of course, Google Drive. For the most part, cloud storage is very iffy on Linux. Out of all of the mainstream solutions out there, only a small amount of them have actively taken the time to create a syncing client specifically for the Linux platform. Google is no different. Despite being huge fans of Linux, there is no official way to access Google Drive on Linux. This means if you’ve centered the way you save and backup files with Google, there’s no Drive folder on your PC for quick and easy file uploading and sharing. Instead, you’ll be stuck uploading things from the web browser, and be forced to miss out on all the neat desktop features Google is adding to Mac and Windows.

Luckily, many Linux developers who rely on Google Drive have grown tired of sitting around, waiting for Google to make a Drive sync program.  They have taken it upon themselves to make programs that allow users to easily access Google Drive on Linux right from the desktop. In this article, we’ll be talking about the best one you can get your hands on right now!

Installing Google-Drive-Ocamlfuse

Google Drive Ocamlfuse is available for many different Linux distributions. Here’s how to get it working:

Ubuntu

You can install Google Drive Ocamlfuse by adding a PPA. Enter these three commands in the terminal to install it.

sudo add-apt-repository ppa:alessandro-strada/ppa
sudo apt-get update
sudo apt-get install google-drive-ocamlfuse

Arch Linux

Arch Linux users can install Google-drive-ocamlfuse from the AUR by building this package. Go to this link, find “download snapshot” and click on it. This will download everything necessary to build the program.

Extract the snapshot by right-clicking on it in the file manager, then selecting “extract”. Once extracted, open up a terminal and enter it with the CD command.

cd ~/Downloads/google-drive-ocamlfuse-git

Inside the directory, there are many files. These all come together when you run the makepkg command.

makepkg

The make command will go out and install all files that Google Drive Ocamlfuse needs, then compile the program from source, and generate an Arch Linux package. When done, install it with:

sudo pacman -U *.pkg.tar.xz

From Source

If your Linux distribution is not in the list, there isn’t an installable package for Google Drive Ocamlfuse. Instead, grab the source code and compile it. This may be a complex process (depending on your skill level), and will take too long to outline here. Instead, head over to the instructions that the developer has laid out to install it.

Syncing with Google-Drive-Ocamlfuse

To sync with Google, first sign in. Do this by running this command in a terminal window:

google-drive-ocamlfuse

Doing this will instantly open a Google Oauth sign in window. Enter the details of your Google account to continue.

Then, create the sync folder with:

mkdir -p ~/Google-Drive

With everything set up, syncing can begin. Pull everything down from Google Drive with this command:

google-drive-ocamlfuse ~/Google-Drive

Uploading Files

Uploading files to Google Drive with the sync client works the same way as downloading. To upload files to a Drive account, simply place any file inside the ~/Google-Drive folder, then run the sync command. As Google Drive Ocamlfuse starts up, it’ll look over the local sync folder for any changes that might have been made and upload those changes. Additionally, deleting a file locally will delete it on Drive as well (just run the sync command after deleting something).

Tips

Remembering a command to sync files from Google Drive can be tricky, especially if you’re a new user. Instead, let’s make a shell script program with all of the details right inside. This way, sending and receiving files from Google Drive is much easier.

In a terminal, write: nano ~/drivesync

This will create a blank file named “drivesync” in the home folder.

Next, paste this first line. This line of code is a shebang. It helps bash understand how to run the script.

#!/bin/bash

Following the shebang, create a space (with the enter key), then paste this:

google-drive-ocamlfuse /home/username/Google-Drive

Note: change username to your username

Save the script by pressing CTRL + O, then use the chmod command to mark it executable:

sudo chmod +x ~/drivesync

Lastly, copy it to /usr/bin with the CP command. This way, drivesync will run anywhere via the command line.

sudo cp ~/drivesync /usr/bin

From now on, sync Google Drive to the /home/username/Google-Drive folder by entering this inside the terminal:

sudo drivesync

Conclusion

Google really has a hit when it comes to Google Drive. It’s got a lot of killer features like document conversion, the reliability of Google servers and an entire office suite to use too. That’s why it’s such a shame you have to go through so much just to access Google Drive on Linux. Hopefully, as Linux gains more mindshare, the idea of Google making a Drive sync client becomes a reality. Till then, syncing files with third party software is as good as it is going to get.