Google Drive is a very popular cloud-based drive and storage service. Google Drive can be used in different ways from Web, Android, iPhone, Windows, macOS, and Linux. But as today Google does not provide native Google Drive client for Linux distributions like Ubuntu, Debian, Centos, Mint, etc. Even Google advises Web Browser in order to work with Google Drive for Linux users there are some 3rd party applications, tools to connect Google Drive to the local Linux system.
Google Drive Linux Clients
There are a lot of different Google Drive clients for Linux operating systems but most of them are incomplete or unpractical or error-prone to use. In this tutorial, we will use the following 2 Google Drive clients that are superior to other alternatives.
- GNOME Online Accounts
- Google Drive Ocamlfuse
Google Drive with GNOME Online Accounts
GNOME Online Accounts is a Gnome project which is created in order to use some popular online services natively with a GNOME desktop. Google Drive is one of the supported online services by Gnome Online Accounts. Gnome Online Accounts is the most stable way to use Google Drive in a Linux operating system because of its Gnome community and support.
In order to use GNOME Online Accounts first, we will install it with the following command. We can install and use the GNOME Online Accounts even we do not use the GNOME desktop environment as all dependencies will be installed automatically. So this means we can use Gnome Online Accounts with other desktop environments like KDE, XFCE, LXDE, etc.
$ sudo apt install gnome-control-center gnome-online-accounts
After the installation is complete we can access the Gnome Online Accounts from the menu or dash with the
GNOME Control Center like below.
From the Gnome Control Center, we will click to the
Online Accounts section and the supported online services will be listed in the main screen. We will select the
In the following step we need to authenticate to the Google Drive accounts we want to use and sync. We will be asked for the Google Account or user name with the following screen. We will put the Google user name which is
poftut in this case. We will also be informed that this account will be integrated with the GNOME application.
In the following step, we will provide the password of the previously provided account. We will also display the password in clear text by clicking the eye icon in order to make sure password correctness.
In the following step, we will allow the Gnome to access our provided Google account and related Google services. As we can see that the account will be completely controlled with this GNOME application. We will click to
In this step, we will allow our provided Google Account to be used with the following services. As we want to access Google Drive we will enable Documents in this case. An alternative we can enable or disable other services. For security reasons please disable the Google services you will not use.
Now we have integrated Google Drive and use it with a native file browser like Gnome Files, Nautilus, etc. The added Google Drive account will be listed in the left location pane with the account email address as below. We can navigate Google drive files like local files and folders.
Google Drive with Google Drive Ocamlfuse
google-drive-ocamlfuse is a FUSE filesystem for Google Drive, written in OCaml. It lets you mount your Google Drive on Linux distributions. As a script or filesystem library it is managed via command line but can be used with GUI like File Browsers. It provides the following features.
- Full read/write access to ordinary files and folders
- Read-only access to Google Docs, Sheets, and Slides (exported to configurable formats)
- Multiple account support
- Duplicate file handling
- Access to trash (
- Unix permissions and ownership
- Symbolic links
- Read-ahead buffers when streaming
- Accessing content shared with you (requires configuration)
- Team Drive Support
- Service Account Support
- OAuth2 for Devices Support
Let’s start the installation. As a non-standard script, we need to add some extra repository to our Linux system. Ocamlfuse packages are created for the Ubuntu distribution so in order to use other Linux distributions the source code installation should be executed which is explained here.
$ sudo add-apt-repository ppa:alessandro-strada/ppa
Now we will install the OcamlFuse with the following command. The package name is
$ sudo apt-get install google-drive-ocamlfuse
Now as stated previously we will complete the Google Drive integration from the command line. First, we will create a directory where Google Drive will be mounted. In this case, we will name the directory as
$ mkdir googledrive
Now we will run the
google-drive-ocamlfuse command like below.
This command will open the web browser in order to authenticate the Google Drive user with username and password. We will provide the username
poftut like below.
We will provide the user password with the following screen.
In the following screen, we will see that gdfuse which is the google-drive-ocamlfuse name wants to access the Google Drive files. We will simply click to
We can also see the following screen where we need to allow the account to the Google Account.
If everything is complete successfully we the web browser will be redirected to a success page which is like below and provided by gdfuse.
Now as the last step we will mount our Google Drive to the directory we have previously created named
googledrive like below.
$ google-drive-ocamlfuse googledrive
If there is no error message everything is ok. We can list the Google Drive files from the command line or a standard file manager like below.
$ ls -l googledrive/
As an extra check, we can list already mounted file systems with the df command where Google Drive will also list. We can also get information like available size, used size, total size, and percentage information.
$ df -lh