# khard subcommands

These are all the subcommands and accepted arguments of khard(1).

    usage: khard [-h] [-c CONFIG] [--debug] [--skip-unparsable] [-v]
                 SUBCOMMAND ...

## Positional Arguments

`SUBCOMMAND`

  Possible choices: list, ls, show, details, template, birthdays, bdays, email, phone, postaddress, post, postaddr, new, add, add-email, merge, edit, modify, ed, copy, cp, move, mv, remove, delete, del, rm, addressbooks, abooks, filename, file

## Named Arguments

`-c, --config`

  config file to use

`--debug`

  enable debug output

  Default: `False`

`--skip-unparsable`

  skip unparsable vcard files

  Default: `False`

`-v, --version`

  show program’s version number and exit

## Sub-commands

### list (ls)

list all (selected) contacts

    khard list [-h] [-a ADDRESSBOOK] [-f]
               [-d {first_name,last_name,formatted_name}] [-g] [-r]
               [-s {first_name,last_name,formatted_name}] [-p] [-F FIELDS]
               [search terms ...]

#### Positional Arguments

`search terms`

  search in specified or all fields to find matching contact

  Default: `[]`

#### Named Arguments

`-a, --addressbook`

  Specify one or several comma separated address book names to narrow the list of contacts

  Default: `[]`

`-f, --search-in-source-files`

  Look into source vcf files to speed up search queries in large address books. Beware that this option could lead to incomplete results.

  Default: `False`

`-d, --display`

  Possible choices: first_name, last_name, formatted_name

  Display names in contact table by first or last name

`-g, --group-by-addressbook`

  Group contact table by address book

  Default: `False`

`-r, --reverse`

  Reverse order of contact table

  Default: `False`

`-s, --sort`

  Possible choices: first_name, last_name, formatted_name

  Sort contact table by first or last name

`-p, --parsable`

  Machine readable format: uidtcontact_nametaddress_book_name

  Default: `False`

`-F, --fields`

  Comma separated list of fields to show (use -F help for a list of top level fields)

  Default: `[]`

### show (details)

display detailed information about one contact

    khard show [-h] [-a ADDRESSBOOK] [-f]
               [-d {first_name,last_name,formatted_name}] [-g] [-r]
               [-s {first_name,last_name,formatted_name}]
               [--format {pretty,yaml,vcard}] [-o OUTPUT_FILE]
               [search terms ...]

#### Positional Arguments

`search terms`

  search in specified or all fields to find matching contact

  Default: `[]`

#### Named Arguments

`-a, --addressbook`

  Specify one or several comma separated address book names to narrow the list of contacts

  Default: `[]`

`-f, --search-in-source-files`

  Look into source vcf files to speed up search queries in large address books. Beware that this option could lead to incomplete results.

  Default: `False`

`-d, --display`

  Possible choices: first_name, last_name, formatted_name

  Display names in contact table by first or last name

`-g, --group-by-addressbook`

  Group contact table by address book

  Default: `False`

`-r, --reverse`

  Reverse order of contact table

  Default: `False`

`-s, --sort`

  Possible choices: first_name, last_name, formatted_name

  Sort contact table by first or last name

`--format`

  Possible choices: pretty, yaml, vcard

  select the output format

  Default: `'pretty'`

`-o, --output-file`

  Specify output template file name or use stdout by default

  Default: `<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>`

### template

print an empty yaml template

    khard template [-h]

### birthdays (bdays)

list birthdays (sorted by month and day)

    khard birthdays [-h] [-a ADDRESSBOOK] [-f]
                    [-d {first_name,last_name,formatted_name}] [-p]
                    [search terms ...]

#### Positional Arguments

`search terms`

  search in specified or all fields to find matching contact

  Default: `[]`

#### Named Arguments

`-a, --addressbook`

  Specify one or several comma separated address book names to narrow the list of contacts

  Default: `[]`

`-f, --search-in-source-files`

  Look into source vcf files to speed up search queries in large address books. Beware that this option could lead to incomplete results.

  Default: `False`

`-d, --display`

  Possible choices: first_name, last_name, formatted_name

  Display names in birthdays table by first or last name

`-p, --parsable`

  Machine readable format: nametdate

  Default: `False`

### email

list email addresses

    khard email [-h] [-a ADDRESSBOOK] [-f]
                [-d {first_name,last_name,formatted_name}] [-g] [-r]
                [-s {first_name,last_name,formatted_name}] [-p]
                [--remove-first-line]
                [search terms ...]

#### Positional Arguments

`search terms`

  search in specified or all fields to find matching contact

  Default: `[]`

#### Named Arguments

`-a, --addressbook`

  Specify one or several comma separated address book names to narrow the list of contacts

  Default: `[]`

`-f, --search-in-source-files`

  Look into source vcf files to speed up search queries in large address books. Beware that this option could lead to incomplete results.

  Default: `False`

`-d, --display`

  Possible choices: first_name, last_name, formatted_name

  Display names in contact table by first or last name

`-g, --group-by-addressbook`

  Group contact table by address book

  Default: `False`

`-r, --reverse`

  Reverse order of contact table

  Default: `False`

`-s, --sort`

  Possible choices: first_name, last_name, formatted_name

  Sort contact table by first or last name

`-p, --parsable`

  Machine readable format: addresstnamettype

  Default: `False`

`--remove-first-line`

  remove “searching for ‘’ …” line from parsable output (that line is required by mutt)

  Default: `False`

### phone

list phone numbers

    khard phone [-h] [-a ADDRESSBOOK] [-f]
                [-d {first_name,last_name,formatted_name}] [-g] [-r]
                [-s {first_name,last_name,formatted_name}] [-p]
                [search terms ...]

#### Positional Arguments

`search terms`

  search in specified or all fields to find matching contact

  Default: `[]`

#### Named Arguments

`-a, --addressbook`

  Specify one or several comma separated address book names to narrow the list of contacts

  Default: `[]`

`-f, --search-in-source-files`

  Look into source vcf files to speed up search queries in large address books. Beware that this option could lead to incomplete results.

  Default: `False`

`-d, --display`

  Possible choices: first_name, last_name, formatted_name

  Display names in contact table by first or last name

`-g, --group-by-addressbook`

  Group contact table by address book

  Default: `False`

`-r, --reverse`

  Reverse order of contact table

  Default: `False`

`-s, --sort`

  Possible choices: first_name, last_name, formatted_name

  Sort contact table by first or last name

`-p, --parsable`

  Machine readable format: numbertnamettype

  Default: `False`

### postaddress (post, postaddr)

list postal addresses

    khard postaddress [-h] [-a ADDRESSBOOK] [-f]
                      [-d {first_name,last_name,formatted_name}] [-g] [-r]
                      [-s {first_name,last_name,formatted_name}] [-p]
                      [search terms ...]

#### Positional Arguments

`search terms`

  search in specified or all fields to find matching contact

  Default: `[]`

#### Named Arguments

`-a, --addressbook`

  Specify one or several comma separated address book names to narrow the list of contacts

  Default: `[]`

`-f, --search-in-source-files`

  Look into source vcf files to speed up search queries in large address books. Beware that this option could lead to incomplete results.

  Default: `False`

`-d, --display`

  Possible choices: first_name, last_name, formatted_name

  Display names in contact table by first or last name

`-g, --group-by-addressbook`

  Group contact table by address book

  Default: `False`

`-r, --reverse`

  Reverse order of contact table

  Default: `False`

`-s, --sort`

  Possible choices: first_name, last_name, formatted_name

  Sort contact table by first or last name

`-p, --parsable`

  Machine readable format: addresstnamettype

  Default: `False`

### new (add)

create a new contact

    khard new [-h] [-a ADDRESSBOOK] [-i INPUT_FILE] [--open-editor]
              [--vcard-version {3.0,4.0}]

#### Named Arguments

`-a, --addressbook`

  Specify address book in which to create the new contact

  Default: `[]`

`-i, --input-file`

  Specify input template file name or use stdin by default

  Default: `'-'`

`--open-editor, --edit`

  Open the default text editor after successful creation of new contact

  Default: `False`

`--vcard-version`

  Possible choices: 3.0, 4.0

  Select preferred vcard version for new contact

### add-email

Extract email address from the “From:” field of an email header and add to an existing contact or create a new one

    khard add-email [-h] [-a ADDRESSBOOK] [-i INPUT_FILE] [-f]
                    [-d {first_name,last_name,formatted_name}] [-g] [-r]
                    [-s {first_name,last_name,formatted_name}]
                    [--vcard-version {3.0,4.0}] [-H HEADERS]
                    [--skip-already-added]
                    [search terms ...]

#### Positional Arguments

`search terms`

  search in specified or all fields to find matching contact

  Default: `[]`

#### Named Arguments

`-a, --addressbook`

  Specify one or several comma separated address book names to narrow the list of contacts

  Default: `[]`

`-i, --input-file`

  Specify input email header file name or use stdin by default

  Default: `'-'`

`-f, --search-in-source-files`

  Look into source vcf files to speed up search queries in large address books. Beware that this option could lead to incomplete results.

  Default: `False`

`-d, --display`

  Possible choices: first_name, last_name, formatted_name

  Display names in contact table by first or last name

`-g, --group-by-addressbook`

  Group contact table by address book

  Default: `False`

`-r, --reverse`

  Reverse order of contact table

  Default: `False`

`-s, --sort`

  Possible choices: first_name, last_name, formatted_name

  Sort contact table by first or last name

`--vcard-version`

  Possible choices: 3.0, 4.0

  Select preferred vcard version for new contact

`-H, --headers`

  Extract contacts from the given comma separated header fields. all searches all headers.

  Default: `['from']`

`--skip-already-added`

  Skip already added email addresses

  Default: `False`

### merge

merge two contacts

    khard merge [-h] [-a ADDRESSBOOK] [-A TARGET_ADDRESSBOOK] [-f]
                [-t TARGET_CONTACT] [-d {first_name,last_name,formatted_name}]
                [-g] [-r] [-s {first_name,last_name,formatted_name}]
                [source ...]

#### Positional Arguments

`source`

  search in specified or all fields to find matching source contact

  Default: `[]`

#### Named Arguments

`-a, --addressbook`

  Specify one or several comma separated address book names to narrow the list of source contacts

  Default: `[]`

`-A, --target-addressbook`

  Specify one or several comma separated address book names to narrow the list of target contacts

  Default: `[]`

`-f, --search-in-source-files`

  Look into source vcf files to speed up search queries in large address books. Beware that this option could lead to incomplete results.

  Default: `False`

`-t, --target-contact, --target`

  search for a matching target contact

`-d, --display`

  Possible choices: first_name, last_name, formatted_name

  Display names in contact table by first or last name

`-g, --group-by-addressbook`

  Group contact table by address book

  Default: `False`

`-r, --reverse`

  Reverse order of contact table

  Default: `False`

`-s, --sort`

  Possible choices: first_name, last_name, formatted_name

  Sort contact table by first or last name

### edit (modify, ed)

edit the data of a contact

    khard edit [-h] [-a ADDRESSBOOK] [-i INPUT_FILE] [--open-editor] [-f]
               [-d {first_name,last_name,formatted_name}] [-g] [-r]
               [-s {first_name,last_name,formatted_name}] [--format {yaml,vcard}]
               [search terms ...]

#### Positional Arguments

`search terms`

  search in specified or all fields to find matching contact

  Default: `[]`

#### Named Arguments

`-a, --addressbook`

  Specify one or several comma separated address book names to narrow the list of contacts

  Default: `[]`

`-i, --input-file`

  Specify input template file name or use stdin by default

  Default: `'-'`

`--open-editor, --edit`

  Open the default text editor after successful creation of new contact

  Default: `False`

`-f, --search-in-source-files`

  Look into source vcf files to speed up search queries in large address books. Beware that this option could lead to incomplete results.

  Default: `False`

`-d, --display`

  Possible choices: first_name, last_name, formatted_name

  Display names in contact table by first or last name

`-g, --group-by-addressbook`

  Group contact table by address book

  Default: `False`

`-r, --reverse`

  Reverse order of contact table

  Default: `False`

`-s, --sort`

  Possible choices: first_name, last_name, formatted_name

  Sort contact table by first or last name

`--format`

  Possible choices: yaml, vcard

  specify the file format to use when editing

  Default: `'yaml'`

### copy (cp)

copy a contact to a different addressbook

    khard copy [-h] [-a ADDRESSBOOK] [-A TARGET_ADDRESSBOOK] [-f]
               [-d {first_name,last_name,formatted_name}] [-g] [-r]
               [-s {first_name,last_name,formatted_name}]
               [search terms ...]

#### Positional Arguments

`search terms`

  search in specified or all fields to find matching contact

  Default: `[]`

#### Named Arguments

`-a, --addressbook`

  Specify one or several comma separated address book names to narrow the list of contacts

  Default: `[]`

`-A, --target-addressbook`

  Specify target address book in which to copy / move the selected contact

  Default: `[]`

`-f, --search-in-source-files`

  Look into source vcf files to speed up search queries in large address books. Beware that this option could lead to incomplete results.

  Default: `False`

`-d, --display`

  Possible choices: first_name, last_name, formatted_name

  Display names in contact table by first or last name

`-g, --group-by-addressbook`

  Group contact table by address book

  Default: `False`

`-r, --reverse`

  Reverse order of contact table

  Default: `False`

`-s, --sort`

  Possible choices: first_name, last_name, formatted_name

  Sort contact table by first or last name

### move (mv)

move a contact to a different addressbook

    khard move [-h] [-a ADDRESSBOOK] [-A TARGET_ADDRESSBOOK] [-f]
               [-d {first_name,last_name,formatted_name}] [-g] [-r]
               [-s {first_name,last_name,formatted_name}]
               [search terms ...]

#### Positional Arguments

`search terms`

  search in specified or all fields to find matching contact

  Default: `[]`

#### Named Arguments

`-a, --addressbook`

  Specify one or several comma separated address book names to narrow the list of contacts

  Default: `[]`

`-A, --target-addressbook`

  Specify target address book in which to copy / move the selected contact

  Default: `[]`

`-f, --search-in-source-files`

  Look into source vcf files to speed up search queries in large address books. Beware that this option could lead to incomplete results.

  Default: `False`

`-d, --display`

  Possible choices: first_name, last_name, formatted_name

  Display names in contact table by first or last name

`-g, --group-by-addressbook`

  Group contact table by address book

  Default: `False`

`-r, --reverse`

  Reverse order of contact table

  Default: `False`

`-s, --sort`

  Possible choices: first_name, last_name, formatted_name

  Sort contact table by first or last name

### remove (delete, del, rm)

remove a contact

    khard remove [-h] [-a ADDRESSBOOK] [-f]
                 [-d {first_name,last_name,formatted_name}] [-g] [-r]
                 [-s {first_name,last_name,formatted_name}] [--force]
                 [search terms ...]

#### Positional Arguments

`search terms`

  search in specified or all fields to find matching contact

  Default: `[]`

#### Named Arguments

`-a, --addressbook`

  Specify one or several comma separated address book names to narrow the list of contacts

  Default: `[]`

`-f, --search-in-source-files`

  Look into source vcf files to speed up search queries in large address books. Beware that this option could lead to incomplete results.

  Default: `False`

`-d, --display`

  Possible choices: first_name, last_name, formatted_name

  Display names in contact table by first or last name

`-g, --group-by-addressbook`

  Group contact table by address book

  Default: `False`

`-r, --reverse`

  Reverse order of contact table

  Default: `False`

`-s, --sort`

  Possible choices: first_name, last_name, formatted_name

  Sort contact table by first or last name

`--force`

  Remove contact without confirmation

  Default: `False`

### addressbooks (abooks)

list addressbooks

    khard addressbooks [-h]

### filename (file)

list filenames of all matching contacts

    khard filename [-h] [-a ADDRESSBOOK] [-f]
                   [-d {first_name,last_name,formatted_name}] [-g] [-r]
                   [-s {first_name,last_name,formatted_name}]
                   [search terms ...]

#### Positional Arguments

`search terms`

  search in specified or all fields to find matching contact

  Default: `[]`

#### Named Arguments

`-a, --addressbook`

  Specify one or several comma separated address book names to narrow the list of contacts

  Default: `[]`

`-f, --search-in-source-files`

  Look into source vcf files to speed up search queries in large address books. Beware that this option could lead to incomplete results.

  Default: `False`

`-d, --display`

  Possible choices: first_name, last_name, formatted_name

  Display names in contact table by first or last name

`-g, --group-by-addressbook`

  Group contact table by address book

  Default: `False`

`-r, --reverse`

  Reverse order of contact table

  Default: `False`

`-s, --sort`

  Possible choices: first_name, last_name, formatted_name

  Sort contact table by first or last name

## See also

khard(1).