### 3.1 Finding Units ¶

The `units` database includes many units, and it can sometimes be difficult to remember every name. The interactive `search` command examines only unit names, so it cannot be used to find units whose definitions contain a pattern. If `units` is invoked with the `--list-units` option, the output can be sent to a filter such as `grep`, examining the unit name and the definition. For example,

    units --list-units | grep ';'
    dms                                    deg;arcmin;arcsec
    ftin                                   ft;in;1|8 in
    ftin16                                 ft;in;1|16 in
    ftin32                                 ft;in;1|32 in
    ftin4                                  ft;in;1|4 in
    ftin64                                 ft;in;1|64 in
    ftin8                                  ft;in;1|8 in
    hms                                    hr;min;sec
    inchfine                               in;1|8 in;1|16 in;1|32 in;1|64 in
    time                                   year;day;hr;min;sec
    uswt                                   lb;oz
      .  .  .

could find all unit lists, which include at least one semicolon in their definitions.

The `search` command doesn’t support regular expressions, but with the `--list-units` option the output can be sent to a filter such as `grep`, which does. If you expect a long list of results, you can send the output of the filter to a pager. For example,

    units --list-units | grep 'paper[[:space:]]' | more
    A0paper                                841 mm 1189 mm
    A10paper                               26 mm 37 mm
    A1paper                                594 mm 841 mm
    A2paper                                420 mm 594 mm
    A3paper                                297 mm 420 mm
    A4paper                                210 mm 297 mm
    A5paper                                148 mm 210 mm
    A6paper                                105 mm 148 mm
    A7paper                                74 mm 105 mm
    A8paper                                52 mm 74 mm
    A9paper                                37 mm 52 mm
      .  .  .

could show a list of all defined paper sizes.