LinuxCommandLibrary

mkid

Create an identifier database

TLDR

Build an ID database for the current directory

$ mkid
copy

Build an ID database for specific directories
$ mkid [path/to/directory1 path/to/directory2 ...]
copy

Build an ID database and save it to a specific file
$ mkid [[-o|--output]] [path/to/database.id]
copy

Include only specific languages
$ mkid [[-i|--include]] "[language1 language2 ...]"
copy

Exclude specific directories from indexing
$ mkid [[-p|--prune]] [path/to/excluded_directory]
copy

Display statistics after building the database
$ mkid [[-s|--statistics]]
copy

SYNOPSIS

mkid [-v] [file …]

PARAMETERS

-v
    Enable verbose output, printing progress during indexing.

DESCRIPTION

mkid is a utility from the id-utils package that generates a compact ID database file for fast searching of identifiers in C/C++ source code. It extracts symbols like functions, variables, typedefs, and macros from source files, storing them in a sorted list for binary search.

Primarily used with id(1) (identifier search) and gid(1) (global identifier search across directories), it speeds up navigation in large codebases without the overhead of recursive grep. The database ignores comments and strings, focusing on valid C identifiers.

By default, without arguments, mkid indexes all files matching *.c, *.h, *.y, or *.l in the current directory. Specify files explicitly for targeted indexing. Re-run after code changes to update the database.

CAVEATS

Limited to C-style identifiers; does not index strings, comments, or non-C files effectively. Default behavior scans only current directory—use explicit paths for subdirs. Database (ID) overwrites if exists; no append mode.

DEFAULT INDEXING

Without files, processes all *.c, *.h, *.y, *.l in current directory.

OUTPUT

Generates ID file (binary searchable database) in current directory.

HISTORY

Part of id-utils by Dean Roehrich, originally released in 1993. Designed for efficient code searching pre-IDE era; remains lightweight alternative to ctags or modern tools.

SEE ALSO

id(1), gid(1)

Copied to clipboard