Google Drive is a cloud storage provided by Google, which allows file sync, file sharing and collaborative editing. As of this writing, Google offers Google Drive client software on multiple platforms: Windows, Mac OS X, Android and iOS. Notably, however, the official Linux client for Google Drive is still missing. So if you want to access Google Drive on Linux, you need to either access Google Drive on the web, or use existing unofficial Linux client software.
One such unofficial Linux client for Google Drive is Grive, an open-source command-line client for Google Drive.Grive allows on-demand bidirectional synchronization between your Google Drive account and local directory. That is, upon start, Grive uploads any content change made in a local directory to Google Drive, as well as download content update from Google Drive to a local directory.
In this tutorial, I will describe how to sync Google Drive from the command line by using Grive.
To install Grive on Ubuntu:
$ sudo add-apt-repository ppa:nilarimogard/webupd8 $ sudo apt-get update $ sudo apt-get install grive
If you want to build Grive from source code, you can do the following.
$ sudo apt-get install cmake build-essential libgcrypt11-dev libjson0-dev libcurl4-openssl-dev libexpat1-dev libboost-filesystem-dev libboost-program-options-dev binutils-dev $ wget http://www.lbreda.com/grive/_media/packages/0.2.0/grive-0.2.0.tar.gz $ tar xvfvz grive-0.2.0.tar.gz $ cd grive-0.2.0 $ cmake . $ make $ sudo make install
Now that Grive is installed, you can go ahead and launch it. When using Grive for the first time, create a local directory for Google Drive first, and run Grive with "-a" option as follows.
$ mkdir ~/google_drive $ cd ~/google_drive $ grive -a
The above command will print out the Google authentication URL, and prompt you to enter the authentication code.
To obtain the authentication code, open up a web browser, and copy and paste the Google authentication URL into the web browser bar. You will be asked to sign in to your Google account. Once you sign in to Google, you will be asked whether to give Grive a permission. Click on "Allow access".
You will then see the authentication code created for you. Copy and paste the authentication code to the Griveprompt. Grive will go through authentication and start synchronizing folders and content between Google Drive and the local directory, as shown below.
Whenever you have made any change either in the local directory or Google Drive, you can sync Google Drive and the local directory by running Grive inside the local directory. Grive will automatically detect the change, and perform either downloading or uploading the diff.
$ cd ~/google_drive $ grive
Could you please tell me how to prevent some folders from syncing to the local Google_drive folder?
@Steve http://vpsmate.net/mount-google-drive-linux-vps-mapping-sync.html This tip gives you a way that only maps the remote drive as a local drive but no sync. In this case, I think you can either sync the whole stuff or only map without sync. I don't think you can choose the folder specifically since Google doesn't have official support for Google Drive in Linux