Though there are some work arounds to get your Google Drive files in sync with any Linux based operating system, none of those are satisfiable (at least for me).

But there are two command line tools available that do the job nice.

  • Grive
  • Drive


The grive is a small program to sync google drive files to your local system with the help of short commands.

Additional features of grive are:

  • Single sub directory sync
  • Preview the changes before sync
  • Download only or Upload only featues

Follow the below short tutorial to get started using grive tool.

Installing dependencies

Install the following dependencies using the terminal.

For Debian/Ubuntu based operation systems:

sudo apt-get install git cmake build-essential libgcrypt11-dev libyajl-dev \
    libboost-all-dev libcurl4-openssl-dev libexpat1-dev libcppunit-dev binutils-dev \
    debhelper zlib1g-dev dpkg-dev pkg-config

For Fedora:

pkg install git cmake boost-libs yajl libgcrypt pkgconf cppunit libbfd

Installing grive

Clone the following repository from github

Compile the source

cd grive2
mkdir build
cd build
cmake ..

Upon success, the output will be something like -- Build files have been written to: /home/me/grive2/build.

Compile the source:

make -j4

Install the package

sudo make install

Working with grive

Setup the account

Create a folder for syncing google drive files.

mkdir ~/Grive
cd ~/Grive

Get the authorization code:

grive -a

This will prompt you to go to the specific URL using browser to get the authorization code:

Please go to this URL and get an authentication code:

- - ---

Please input the authentication code here:

Copy the URL in the browser and follow the on-screen instructions to get the code. Paste the code in ther terminal and press enter to finish the setup.

In my case the code is something like this:


Immediately grive will start syncing your Google Drive files to your local system.

Preview your changes

Make some changes to see preview featues.

mkdir test
echo "Testing" > test/testfile.txt
grive --dry-run

This gives output like below:

Reading local directories
Reading remote server file list
Synchronizing files (dry-run)
sync "./test" doesn't exist in server, uploading
sync "./test/testfile.txt" doesn't exist in server, uploading

** Note **: Files are not uploaded to Google Drive. This is just preview.

Sync your changes

Either you can sync all your work at once or you can sync specific directory. To sync eveything:


To sync only specific directory:

grive --dir test

For complete list of grive options:

grive --help


drive is a small program to pull or push google drive files to or from your local system.

Installing dependencies

Download go prgramming tools

Open the terminal and enter the following command to download go programming tools

wget -c

Installing go programming tools

sudo tar -C /usr/local -xzf go1.9.3.linux-amd64.tar.gz
cat << ! >> ~/.bashrc
export PATH=$PATH:/usr/local/go/bin

Set GOPATH env variable

cat << ! >> ~/.bashrc
export GOPATH=$HOME/gopath
source ~/.bashrc

Installing drive

For Debian or Debian based systems

sudo apt-get install software-properties-common dirmngr
sudo apt-add-repository 'deb ./'
sudo apt-key adv --keyserver --recv-keys 7086E9CC7EC3233B
sudo apt-key update
sudo apt-get update
sudo apt-get install drive

For Ubuntu or Ubuntu based systems

sudo add-apt-repository ppa:twodopeshaggy/drive
sudo apt-get update
sudo apt-get install drive

For Fedora based systems

dnf copr enable vaughan/drive-google
dnf install drive-google

Working with drive

Authentication with google drive account

Create a folder for syncing google drive files.

mkdir ~/Drive
cd ~/Drive

Use the following command to add your google drive account to the current folder.

drive init

This will produce the output like below:

Visit this URL to get an authorization code
Paste the authorization code: 

Note the URL from the output. In my case the URL is:

Copy the URL link from the above output and paste it into the browser. Follow the on-screen instructions for your account and it will provide the authorization code. It looks like this:


Paste the code in the terminal and press Enter. Now your google drive files are ready to be synced in the current folder.

Pull your files

drive pull

This might take some time for analysing your google drive data. After the completion of analysing part, it prompts you with list of downloadable files, size. Press Y to start downloading files.

Addition count 124 src: 466.47MB
Proceed with the changes? \[Y/n]:

In case, if your google drive files name have an invalid characters, drive throws you with the following error:

clashes detected. Use `ignore-name-clashes` to override this behavior or `fix-clashes` to try fixing this

This can be rectified using the following command:

drive clashes -fix

After that try pulling with drive pull command.

Making changes

You can edit, create or delete files locally. To view your changes, use the following command:

drive diff

The output might be something like this:

File: /Others/wpa_supp_logs.txt

* local:          2018-01-31T18:00:01.000Z                
* remote:         2016-08-04T12:07:22.000Z\
- - -

\--- /home/nayab/Drive/Others/wpa_supp_logs.txt	2018-01-31 23:30:00.604117061 +0530
+++ .xtmp3916589616287113937.tmp229874439	2018-01-31 23:30:19.360313667 +0530
@@ -13,6 +13,14 @@
 Line: 1 - start of a new network block
 ssid - hexdump_ascii(len=4):
      77 6f 6c 66                                       wolf\
+key_mgmt: 0x2
+PSK (ASCII passphrase) - hexdump_ascii(len=9): \[REMOVED]
+pairwise: 0x10
+group: 0x10
+proto: 0x3
+PSK (from passphrase) - hexdump(len=32): \[REMOVED]
+Priority group 0

* id=0 ssid='wolf'
   athr: Driver version 
   call80211ioctl: 5 op=0x8be1 (GETPARAM) subop=0x284=644 value=0x0,0x0
   call80211ioctl: op=0x8be1 (GETPARAM) subop=0x284=644 value=0x0,0x0 failed: 95 (Operation not supported)
  @@ -391,4 +399,4 @@
   /home/cli/menu # 
   /home/cli/menu # 
   /home/cli/menu # 
  -/home/cli/menu # 
  +/home/cli/menu # 
  \ No newline at end of file

- - -

/testfile only on local

Uploading to drive

Use the following command to push your local changes to your drive account

drive push

Hope you like the post. Comments in case you are stuck at somewhere.