How to connect Google Drive to Linux using Grive

Grive – the console client allows you to synchronize data with Google Drive.

Install the necessary components:

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

Tried to install the command apt-get install grive, but in this case I have an old version installed, which is no longer workable.
So create a directory and clone the latest Grive source files from the official source:

mkdir grive
cd grive/
sudo git clone https://github.com/Grive/grive.git
cd grive/

Let’s build Grive from the source files:

sudo dpkg-buildpackage -j4

If desired, you can build manually:

mkdir build
cd build
sudo cmake ..
sudo make -j4
sudo make install

The installation of Grive is complete, now we will create and move to any directory where Google Drive will be synchronized:

mkdir ~/GoogleDrive
cd ~/GoogleDrive

Request an authorization token from Google:

grive -a

After the startup, a link will be generated that will need to go to the browser, login to the account, allow access, copy the response code and enter it in the terminal, then synchronization will begin.

In the future, for synchronization, go to the directory and run Grive:

cd ~/GoogleDrive
grive

You can save the synchronization report to a file:

grive -l ~/log.txt

To view the current version of Grive, use the command:

sudo grive -v