How to Sync Google Drive on Linux

Are you wondering if you can use Google Drive to sync your local file on Linux? 

Although Google Drive provides official clients for Windows and Mac, there is no official client for Linux. Fortunately, there are several third-party and open-source utilities to sync google drive in Linux. 

In this blog post, I’ll discuss several ways to sync google drive in Linux automatically. I’ll cover graphical and command line utilities and discuss their pros and cons.

Insync 

Insync provides a complete solution for synchronizing google drive in Linux. It supports selective syncing, multiple accounts, and real-time syncing. Insync is easy to set up and use. But this tool is not free. With a one-time payment of $11.99 / cloud account, you can enjoy the Insync. If you are unsure about purchasing, you can get a 7-day free trial to check if this tool can fix your syncing problem.

To start using Insync, first download the application from the official website. This app supports popular Linux distributions like Ubuntu, Debian, Linux Mint, Fedora, and Arch Linux. You will get an option to download Insync for your distribution.

The installation process is also straightforward and is discussed on their official website

Once you download and install the Insync, open the application.

User Interface of Insync

After opening the application, choose Google Drive and sign in to your Google Drive account. When it comes to syncing, Insyc provides you full control. By default, Insync syncs all the Google Drive folders to the local machine. But you can selective sync if you prefer to sync a specific folder. It provides an option to choose to update in real-time or manually.

syncing in insync

After setting up Insync, it will download and save google drive files on the local machine. Depending on your drive size, this process may take some time. Any changes to files and folders will synchronize in real-time with google drive. 

Overall, Insycs is a great tool for those who want simplicity and a complete solution for syncing google drive in Linux. But if you searching for an accessible alternative, we got you covered.

Rclone

Rclone is a popular open-source command line utility to sync Google Drive. Rclone supports over 40 cloud service providers, making it the most powerful sync tool. With rclone you can sync files and folders between google drive and the local machine. You can also sync files between different cloud service providers.

Install and Configure Rclone

If you are using Ubuntu/Debian, you can install Rclone with the following command.

sudo apt install rclone

If you are Arch Linux user, you can install rclone with the following command

sudo pacman -S rclone

If you are using Fedora, you can use the following command

sudo dnf install rclone

After installing rclone, you can connect as many cloud services as possible. To set up your google drive with rclone, use the command

rclone config

And follow the official documentation to set up google drive. If you want to follow this guide easily, I recommend naming your remote google to avoid changing the configuration file later.

Sync Google Drive With Rclone

Once you have configured Google Drive on rclone, you can use rclone sync command to synchronize files between the local machine and Google Drive. The basic command of rclone is

rclone sync google: /path/to/local/directory
  • google: The remote name, and replace the remote name with your configured remote name

In this command source is google drive and the destination is /path/to/local/directory. Unfortunately, rclone doesn’t support bidirectional syncing, so if you want to sync your local files to Google Drive, you have to use

rclone sync /path/to/local/directory google:

So depending on your need, you may need to execute both commands manually to sync google drive. If this looks like too much effort, you may want to set up rclone to sync automatically in both ways.

Setup Cronjob to Sync Automatically

A cron job is a scheduled task that runs automatically at a specified time or interval. Although rclone doesn’t support sync in real-time, we can set up a cron job to sync google drive in nearly real-time.

I assume you are syncing google drive to a local folder named Google. This is important because we need to create a script containing this information. To create a local folder called Google, enter the following command.

mkdir ~/Google

If you prefer using your preferred folder, you can use but using a folder in Google make the configuration easier.

Create a Script

The first step to set up a cron job is to create a script containing the rclone command to sync both ways. Create a script by typing the command in your terminal.

sudo nano ~/.config/rclonescipt.sh

In the script, enter the following rclone command

#!/bin/bash
# Copy from Google drive to Local Folder
rclone bisync google: ~/Google --resync --progress --log-file ~/.config/rclone.log
  • In this example, I’m using a remote name google:Replace the remote name with the remote name you set when configuring Google Drive in rclone

Save the file and exit the nano editor.

Creating a Cron Job

The script we created is not executable, so we need to make it executable by entering the following command.

sudo chmod +x ~/.config/rclonescipt.sh

Now you can create a cron job to automate the syncing process. To create a cron job, enter the command in your terminal.

crontab -e

This command will open the crontab in your default text editor. To create a cron job to execute the script 5 minutes interval, enter the following content in crontab.

*/5 * * * * ~/.config/rclonescipt.sh

Feel free to change 5 minutes to whatever interval you want. The Cron job will start automatically after you boot to your operating system and continue executing at specific intervals. Any changes to your local folder and google drive will sync in specific time intervals.

To check if the cron job is running periodically you can run the command in the terminal

tail -f /var/log/syslog | grep CRON

This will show the cron event as follows

Cron Job statius in linux

This syncing process is smooth and will not cause you any trouble, making this tool a great free tool to sync google drive and any drive you can think of.

Conclusion

Insync and Rclone are powerful tools to sync google drive on Linux machine. Being a paid app, Insync provides full-featured syncing capability with google drive and is much easier to use. While rclone is a command line tool that supports almost all cloud services. Setting the cron job with rclone allows you to sync between google drive and the Local folder in real-time.

Don’t forget to share your favorite Google Drive client with us.

Share your love

Newsletter Updates

Stay updated with our latest guides and tutorials about Linux.

5 Comments

  1. Great tutorial! Just one note: the rclonescript.sh will always exit the cron job, because the line below will output the process running “rclonescript.sh”.

    ps auxc|grep -qs rclone && exit 0

  2. You mention that there is no bidirectional sync and then you do:

    `rclone bisync google: ~/Google –resync –progress –log-file ~/.config/rclone.log`

    I get the error: `rclone bisync google: ~/Google –resync –progress –log-file ~/.config/rclone.log`

    • bisync is still experimental in rclone, so using it in production isn’t recommended.

      From your comment I can see, you have put a signle dash instead of double dash this might cause an issue. Can you share more details about the specific error message you encountered with rclone bisync?

  3. This kind of stuff seems designed to drive people back to using Windows!

    All I want to do is, every time a particular file on my system (I will designate it/them, of course) is modified, it’s also modified in My Drive. But My Drive (in Network/myGmailAddress) isn’t even apparently browse-able in the file manager.

    I realize I could pay someone $40 a year to do this for me (Insync), but in case anyone hasn’t noticed, Windows is completely free now, and this can be done easily there, and without someone demanding cash for doing it. So Insync is not ever going to happen, and really, why am I fooling around with something that claims to be more advanced than Windows, but makes it a trapeze act to do simple but essential stuff?

    Yeah, I’m pretty unhappy right now.

Leave a Reply

Your email address will not be published. Required fields are marked *