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.
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.
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.
Gnome Online Account
Gnome Online Accounts is a centralized tool within the Gnome desktop environment that allows users to integrate various online services, including Google Drive, directly into their system. This integration provides a native-like experience, enabling users to access their cloud files as if they were stored locally. With Gnome Online Accounts, you can manage your online files without needing additional applications or complex configurations.
Setting Up Gnome Online Accounts for Google Drive
To use Google Drive on your Linux machine, you first need to configure Gnome Online Accounts. This setup process is straightforward and involves linking your Google account to the Gnome environment:
Access Gnome Settings
Open settings menu from your system tray or application launcher. Navigate to the āOnline Accountsā section, where you can manage your various online services.
Add Your Google Account
In the Online Accounts section, Select āGoogleā from the list of available services. A new window will prompt you to enter your Google credentials. After logging in with your Google email and password, youāll need to grant permissions for Gnome to access your Google Drive. Ensure that you allow all necessary permissions to facilitate full integration.
Complete the Setup
Once authenticated, your Google account will be added to Gnome Online Accounts. Ensure that you have enable Files from availbel Google services. Your Google Drive will now be accessible through your file manager.
Accessing and Managing Google Drive
Open your file manager (Nautilus in most Gnome-based systems), and you will find your Google account listed under āOther Locationsā or in a dedicated āGoogle Driveā section.
This integration allows you to browse and manage your Google Drive files as if they were on your local hard drive.
- Browsing Files: You can navigate through your Google Drive just like any other folder on your system. Click on folders to open them and view their contents.
- Creating and Organizing Folders: Right-click within your Google Drive to create new folders and organize your files efficiently.
- Uploading and Downloading Files: Drag and drop files between your local system and Google Drive to upload or download them. This functionality makes it easy to keep your cloud storage synchronized with your local files.
- Editing Files: Open and edit files directly from your Google Drive using applications installed on your Linux machine. Any changes made will sync automatically with your Google Drive.
Limitation
While integrating Google Drive with Linux through Gnome Online Accounts offers significant convenience and functionality, there are a few limitations to be aware of
- Limited Offline Access: Offline file access is not as robust as dedicated desktop clients.
- Performance Issues: Slower browsing and searching for large volumes of data.
- File Compatibility: Some file types may need to be downloaded locally to open.
- Limited Integration Features: Advanced Google Drive features are not fully supported.
- Dependency on Internet Connectivity: Requires internet access for file management.
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
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, Gnome Online Account, 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.
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
Thanks for Letting me know.
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?
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.
yeah, I feel the same. But I would not go back to Windows because of it. Windows is a privacy mess right now. Maybe there are better alternatives to google drive. Maybe syncthing could be an alternative. I am searching for alternatives right now.
Insync is now 54$
and despite selecting Google drive in my linux home folder,
insync decided to download all my GDrive into their folder.
Had to purge the app it saturated my slow internet