Home Command line utilities GooBook – Access Your Google Contacts From Commandline In Linux

GooBook – Access Your Google Contacts From Commandline In Linux

By sk
Published: Last Updated on 2.3K views

My work relies mostly on Google products. I use Google docs for managing documents, Gmail for sending and receiving mails, Google Drive for storing my personal data, Google play books for reading books, google translate for translation. I am searching different ways and methods to use some of the aforementioned Google services on Linux. Thankfully, I have already found how to use Google Translate from command line. and how to mount Google drive locally as a virtual file system and access your drive files. Today, we will discuss how to access google contacts from Commandline. I know how to access to use it from a graphical desktop, but not from Commandline. Here is an useful and handy utility called GooBook that allows you to access your Google contacts from commandline. The main purpose of Goobook is to access google contacts from commandline or a command line Email client like Mutt.

This brief tutorial addresses how to install and use Goobook in Linux.

Install GooBook on Linux

GooBook can be installed using any of the following methods:

  • Using pip
  • From a distribution specific repository
  • Using a source tarball

Install GooBook using PIP

The recommended way to install goobook is using pip.

To install PIP on Arch Linux and its derivatives, run:

$ sudo pacman -S python-pip

On RHEL, Fedora, CentOS:

$ sudo yum install epel-release
$ sudo yum install python-pip

Or,

$ sudo dnf install epel-release
$ sudo dnf install python-pip

On Debian, Ubuntu, Linux Mint:

$ sudo apt-get install python-pip

Once PIP installed, run the following command to install Goobook.

$ pip install goobook

Install GooBook from repository

Goobook is available in some Linux distribution's repository. Say for example, on Ubuntu and its derivatives, you can install it using command:

$ sudo apt-get install goobook

For Arch Linux and its derivatives, Goobook is also available in AUR. You can install it using AUR helpers such as Yay.

$ yay -S goobook

Install GooBook from source

You need to install python first. On Ubuntu and its derivatives, the following command will install python.

$ sudo apt-get install python

Download the Goobook tarball from here.

$ wget https://gitlab.com/goobook/goobook/repository/archive.tar.gz

Extract it using command:

$ tar -xzvf goobook-*.tar.gz

Go to the extracted folder:

$ cd goobook-*

Then, run the following command to install it.

$ sudo python ./setup.py install

Congratulations! Now that you've got Goobook set up, it's time to give it a test. Before going to use it, you need to authenticate with Gmail.

Authenticate GooBook with Google accounts

Run the following command to authenticate with your gmail account.

goobook authenticate

Your default browser window will open. Select the Gmail account you'd like to authenticate with.

authenticate with your gmail account

Click 'Allow' to authenticate with your google accounts:

how to authenticate with your gmail account

Finally you'll get confirmation message like below.

The authentication flow has completed.

Also, in your Terminal you'll see a message something below.

/usr/lib/python2.7/site-packages/oauth2client/_helpers.py:255: UserWarning: Cannot access /home/sk/.goobook_auth.json: No such file or directory
 warnings.warn(_MISSING_FILE_MESSAGE.format(filename))

Your browser has been opened to visit:

https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.google.com%2Fm8%2Ffeeds&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2F&response_type=code&client_id=500614897810-h9eub98go537fqplj9k59ouip21j8a1e.apps.googleusercontent.com&access_type=offline

If your browser is on a different machine then exit and re-run this
 application with the command-line parameter

--noauth_local_webserver

Created new window in existing browser session.
 Authentication successful.

Congrats! Now, you have configured Goobook with your Google account. Let us go ahead and see how to use it from commandline.

Access Your Google Contacts From Commandline In Linux Using GooBook

To view/query a Google contact, just run the following command:

$ goobook query senthilkumar

Replace 'senthilkumar' with your google contact name.

Sample output would be like:

Access Your Google Contacts From Commandline In Linux Using GooBook

As you see in the above output, the google contacts will be listed with its group and imported time.

For more details, see:

$ goobook -h

And, that's all. As you can see, Goobook is fairly simple and straightforward  in terms of installation and usage. You can view your google contacts easily from your Terminal in any Linux distribution. Hope this helps!

Resource:

You May Also Like

2 comments

trnces October 1, 2020 - 1:50 pm

google autentification dont accept GooBook 🙁

Reply
sk October 1, 2020 - 7:53 pm

Yes, it is bug. Please look into this thread to fix it -> https://gitlab.com/goobook/goobook/-/issues/83

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More