Michele Marcionelli - Head of IT at D-MATH

ETH address book via command line

Aka. "search active directory via command line"

ethtel

Using the command ethtel that you can download from my repository, you can easily search the ETH address book also from command line, as long as you are at the ETH or connected via VPN:

Usage

$ ethtel -h

usage: ethtel [-h] [-a] [-m] [-t] [-u] [--no-email] [--no-header] [--no-office] [--no-phone] search-string

ETH Phonebook - search in ETH's AD server by first name, last name, e-mail address, phone number and office.

positional arguments:
  search-string

optional arguments:
  -h, --help     show this help message and exit
  -a, --address  print the postal address (only of the 1st entry found) - not compatible with other options
  -m, --mutt     generate a special output for "mutt" - not compatible with other options
  -t, --title    print the title, ex. Frau Dr.
  -u, --ou       print the organisational unit
  --no-email     do not print the email address
  --no-header    do not print the header
  --no-office    do not print the building code and office number
  --no-phone     do not print the phone number

Report bugs to https://gitlab.math.ethz.ch/mmarcio/ethtel/-/issues

Examples

Search by name with default output:

$ ethtel vollenweider
Name                   Phone   Office       E-mail                             
--------------------   -----   ----------   --------------------------------   
Vollenweider Coralie           CHN G 76.2   cv******@student.ethz.ch          
Vollenweider Gabriel   23188   CHN M 16.1   gabr*****lenweider@env.ethz.ch   
Vollenweider Martin    24337   HG G 32.1    mar****nweider@math.ethz.ch   
Vollenweider Yves              LEE O 209    yvol*****ide@student.ethz.ch       

Search by office, adding title and omitting office in output:

$ ethtel ethtel --title --no-office 'HG G 32.1'
Title      Name                  Phone   E-mail                             
--------   -------------------   -----   --------------------------------   
Herr       Latshang Rigzen       22879   rig******ng@math.ethz.ch       
Herr       Mader Mathias         23705   mat***der@math.ethz.ch         
Herr       Marcionelli Michele   26193   mic****lli@math.ethz.ch   
Frau Dr.   Schlönvogt Irene      22239   s***vogt@math.ethz.ch           
Herr       Vollenweider Martin   24337   mar******der@math.ethz.ch   

Output postal address (only for the 1st entry found):

$ ethtel --address marcionelli
ETH Zürich
Herr Michele Marcionelli
IT Services Gruppe (ISG) D-MATH
HG G 32.1
Rämistrasse 101
8092 Zürich

mutt integration

You can use the ETH address book in mutt like this.

Add to your mutt configuration file ~/.muttrc the following line:

set query_command = "ethtel --mutt '%s'"

and restart mutt. Afterwards you can search the ETH address book like this:

That's it.