
Google Drive is a powerful cloud storage service that allows users to access and manage their files from anywhere. It offers a robust set of features, including file sharing, collaboration, and version history.
To access Google Drive from the Linux terminal, you can use the command-line interface (CLI) tool called `rclone`. This tool allows you to mount your Google Drive account as a local filesystem, enabling you to interact with your files using familiar Linux commands.
The `rclone` command is used to configure your Google Drive account for use with the CLI. You'll need to specify your account credentials and the desired mount point for your Google Drive files.
See what others are reading: Mount Google Shared Drive Linux
CLI Clients
CLI Clients are a great way to interact with your Google Drive account from the Linux terminal. You can use CLI clients for tasks such as managing, uploading, downloading, deleting, and sharing files on Google Drive.
One popular CLI client is Gdrive, which can be downloaded from Github. Unfortunately, it doesn't support file synchronization.
Gdrive is a tool that lets you access your Google Drive account through the command line. You need to run commands for any and every Drive operation you want to perform.
If you're looking for a more advanced CLI client, you may want to consider rclone. rclone has several purposes, including synchronizing, copying, or moving files between different cloud storage services or local folders.
Here are the basic steps to install rclone using the official script:
- Select n for a new remote, which is a named remote storage system
- Enter a name for your remote, like gdrive
- Enter the number for Google Drive, which is 18 in rclone 1.62.2
- Leave client_id and client_secret empty unless you have your own Google API credentials
- Choose 1 for full access
- Leave the service_account_file empty
- Avoid advanced configuration with n
- Choose y to authenticate rclone with a browser
- Avoid configuring a shared drive with n
- Select y to confirm the configuration
- Choose q to finish the configuration
Managing Files and Folders
You can access information related to any of your Google Drive files using the "Show file info" command, which is a straightforward way to get the details you need.
To list the contents of your Google Drive, you can use the "List contents" command, which displays files and directories. You can also limit the output to a specific number of files by adding the -m flag.
You can filter the output based on your requirements by adding a query to the "List contents" command, such as searching for files containing a specific word in their name.
List Contents
You can list the contents of your Google Drive using the Gdrive tool.
To do this, use the command "list contents" to display all the files and directories in your Google Drive.
The default maximum number of files displayed is 30, but you can change this limit by adding the -m flag followed by a number.
For example, if you want to see more files, you can use the command "list contents -m 100".
You can also filter the output by adding a query to the command.
Share Files
Sharing files is a common task, and it's easy to do using a specific command. You can grant reader permission to someone by using their email address in the command.
To share a file, you'll need to know the email address of the person you want to share it with. You can then use the command to grant them permission.
You can grant different levels of permission, such as writing or commenting permission, by using the --role flag. The accepted values for this flag include 'owner', 'writer', 'commenter', and 'reader'.
If you want to transfer ownership of a file, you can use the --role flag with the 'owner' value.
Broaden your view: How Do I Share My Google Drive with Someone
Add to GDrive
Adding an account to GDrive is a straightforward process that requires a few simple steps. You'll need to run the command "gdrive account add" to start the process.
This will prompt you for your Google Client ID and Client Secret, which you can find in the Requirements section. Don't worry if you're not sure what these are - just follow the instructions.
Next, you'll be presented with a URL that you need to follow and approve for GDrive to access your Drive. This is a normal part of the setup process.
After approving the access, you'll be redirected to http://localhost:8085, which completes the setup. GDrive is now ready to use!
If you're setting up GDrive on a remote server, things get a bit trickier. The account needs to be added on a local machine and then imported on the remote server.
Here's the workaround:
- Run gdrive account add on your local machine.
- Run gdrive account export <ACCOUNT_NAME> on your local machine.
- Copy the exported archive to the remote server.
- Run gdrive account import <ARCHIVE_PATH> on the remote server.
Verify Drivesync
To verify that DriveSync is working correctly, you need to create a test folder and upload a file to your Google Drive.
Create a folder called Verify_drivesync and upload an image, such as image.png, to it.
To test DriveSync, execute the command gdrive upload Verify_drivesync/image.png. You can see the image uploading to your Google Drive.
As you can see, the image has been uploaded to your Google Drive, and it's now stored in the Verify_drivesync folder.
To verify that DriveSync is working correctly, you can also use the command gdrive ls Verify_drivesync to list the files in the folder.
Here's an example of what the output might look like:
- Verify_drivesync/image.png
Credentials and Setup
To set up Gdrive on your Linux box, you'll need to download the executable file from the tool's official GitHub page. Once downloaded, make sure the file has executable permissions.
You can use the chmod command to grant permissions, for example, `chmod +x gdrive-linux-386`. After that, you'll need to run the executable file with the `--about` argument to allow it to connect to your Google Drive account. The command is `./gdrive-linux-386 --about`.
A unique perspective: Google Drive Shared File Easy Transfer to My Drive
This will prompt you to enter a verification code, which you can obtain by heading to the URL printed in the command's output and authenticating with your Google account. Clicking the 'Allow' button will produce the required code on the web page itself.
Important note: The authentication process will create a token file inside a folder named `.gdrive` located in your home directory. This file contains your account credentials and tokens, and anyone with access to it will also have access to your Google Drive.
Here's a quick summary of the setup process:
- Download the Gdrive executable from GitHub
- Grant executable permissions using `chmod`
- Run the executable with `--about` argument
- Enter verification code to authenticate with Google account
Gdrive saves your account credentials and tokens under `$HOME/.config/gdrive3/`. You don't usually need to use these files directly, but if someone gets access to them, they will also be able to access your Google Drive. Keep them safe!
Discover more: Google Colab Access Google Drive
Features of DriveSync:
DriveSync offers several features that make it a powerful tool for syncing your Google Drive with your local Linux system.
You can download files remotely with DriveSync, which is super convenient if you need to access files from anywhere.
The tool also allows you to upload local files to Google Drive, which is great for keeping your files synced across devices.
DriveSync gives you control over the size of files you can upload and download, with a default setting of 512MB.
You can delete or update files in both your local drive and Google Drive using DriveSync, which is a big time-saver.
One of the coolest features of DriveSync is the ability to enable Autosync using a cronjob, which means your files will stay synced automatically.
Here are the key features of DriveSync in a nutshell:
- Download files remotely
- Upload local files to Google Drive
- Upload and download files with size based on preference (default 512MB)
- Delete or Update files in both local drive and Google Drive
- Enable Autosync using cronjob
Downloading Files
To download files from Google Drive using the Linux terminal, you'll need to meet some basic requirements. You should be using a Linux computer, as this is the only operating system that can access Google Drive files in this way.
Related reading: Using Usb Drive to Sync Google Drive
To ensure you have the necessary tools, you'll need to install Python3 and Pip, which can be easily done using your package manager. Python3 and Pip are essential for installing other software that will help you download files from Google Drive.
Next, you'll need to install the Gdown tool using Pip, which will allow you to download files from Google Drive using the Linux terminal. The Gdown tool is a command-line tool that makes it easy to download files from Google Drive.
Before you can start downloading files, you should be familiar with basic Linux terminal commands. This will help you navigate the process and troubleshoot any issues that may arise.
Now that you have the Gdown tool installed, you can use it to download files from Google Drive. First, open your terminal window and type the download command, replacing DIRECT_DOWNLOAD_LINK with the direct link you copied from the previous step.
Here's an interesting read: Google Drive Linux Download
Featured Images: pexels.com


