A while ago, we have reviewed a command line tool called "GooBook" which is used to access google contacts from the command line. Using GooBook, you can access and view all Gmail contacts. Today, we are going to discuss a similar tool called "ppl". It is a free command line address book that allows you to store your contacts in Unix-like operating systems. To simply put, ppl is developed for the people who wants to keep and maintain their address book from command line.
ppl - A Command Line Address book For Linux
Since ppl is built on top of Ruby and Git, you need to them first. To Install Ruby on your Linux box, refer the following link.
Next, install Git on your Linux system.
$ sudo yum install git
$ sudo apt-get install git
After installing Ruby and Git, run the following command to install ppl.
$ gem install ppl
Fetching: colored-1.2.gem (100%) Successfully installed colored-1.2 Fetching: inifile-2.0.2.gem (100%) Successfully installed inifile-2.0.2 Fetching: i18n-0.8.1.gem (100%) Successfully installed i18n-0.8.1 Fetching: polyglot-0.3.5.gem (100%) Successfully installed polyglot-0.3.5 Fetching: treetop-1.4.15.gem (100%) Successfully installed treetop-1.4.15 [...] Done installing documentation for colored, inifile, i18n, polyglot, treetop, mime-types, mail, morphine, rugged, greencard, ppl after 23 seconds 11 gems installed
If you encountered with an error something like below:
ERROR: CMake is required to build Rugged. *** extconf.rb failed ***
Install Cmake package as shown below.
$ sudo yum install cmake
$ sudo apt-get install cmake
After installing, Cmake re-run "gem install ppl" command.
ppl usage is fairly simple. Have a look at the following examples.
Create Address book
Let us create an address book to store all contacts.
To do so, run:
$ ppl init ~/mycontacts
This command will create a folder called mycontacts in your $HOME folder. You can use any location of your choice for your address book and also you can create any number of address books.
We have created an address book. Now, let us add some contacts. To do so, go to your address book folder (i.e mycontacts in our case):
$ cd ~/mycontacts
Add the contacts one by one as shown below.
$ ppl add apj "Abdul Kalam"
$ ppl add sk "Senthil Kumar"
Similarly, you can add as many contacts as you want. All contacts will be stored in vcard address book (vcf) format.
Store contact details
We have added contacts. Let us add the contact details such as Email, Phone number etc.
To do so, run:
$ ppl email apj email@example.com
$ ppl email sk firstname.lastname@example.org
$ ppl phone sk 0123456789
$ ppl org sk "OSTechNix"
Show a contact details
To view/show a contact details, run:
$ ppl show sk
Senthil Kumar <email@example.com> Organizations: OSTechNix Email Addresses: firstname.lastname@example.org Phone Numbers 0123456789
List all contacts
To view all list of contacts in your address book, run:
$ ppl ls
Sample output would be:
apj: Abdul Kalam <email@example.com> sk: Senthil Kumar <firstname.lastname@example.org>
Just in case, if there are any corrections in contact details, you can edit and correct them as well.
To change a particular contact's ID, say for example apj, run:
$ ppl mv apj missileman
This command changes the contact ID apj to missileman.
To verify it, list the contacts:
$ ppl ls
missileman: Abdul Kalam <email@example.com> sk: Senthil Kumar <firstname.lastname@example.org>
As you see above, the ID apj has been renamed to missileman.
Similarly, you can change the contact's name as shown below.
$ ppl name Senthil Kumar "Palani"
The above command will change the name "Senthil Kumar" to "Palani".
It's also possible to change a contact's Email id.
$ ppl email sk email@example.com
And, we can add/edit the date of birth of a contact too.
ppl bday apj 1931-10-15
Search address book
You can search through your address book with a particular search term to find out the details of a specific contact as shown below.
$ ppl grep senthil
The above command will search on the address book for all contacts that matches with the search term "senthil".
To remove any contacts, just run:
$ ppl rm sk
Set default address book
Some of you might want to keep multiple address books for various purpose. I used to keep two address books, one for personal contacts, and another one for professional contacts.
In such cases, you can define your default address book for storing contacts. To do so, create a file called pplconfig:
$ vi ~/.pplconfig
Add the following lines. Replace ~/mycontacts with your own path.
[address book] path = ~/mycontacts
This tells the ppl utility to save all contacts in the default address book (i.e~/mycontacts) even after you cd into another directory.
For more details, refer ppl documentation guide.