OS Manuals

/usr/bin/ctags

Maintained ctags implementation that generates an index of source code definitions

From universal-ctags 6.2.1-r1 (os), captured 2026-11-05 by running ctags --help (exit 0). permalink

Universal Ctags 6.2.1(v6.2.1), Copyright (C) 2015-2025 Universal Ctags Team
Universal Ctags is derived from Exuberant Ctags.
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
  Compiled: Aug 31 2026, 04:15:46
  URL: https://ctags.io/
  Output version: 1.1
  Optional compiled features: +wildcards, +regex, +iconv, +option-directory, +xpath, +json, +interactive, +yaml, +packcc, +optscript

Usage: ctags [options] [file(s)]

Input/Output Options
  --exclude=<pattern>
       Exclude files and directories matching <pattern>.
       See also --exclude-exception option.
  --exclude-exception=<pattern>
      Don't exclude files and directories matching <pattern> even if
      they match the pattern specified with --exclude option.
  --filter[=(yes|no)]
       Behave as a filter, reading file names from standard input and
       writing tags to standard output [no].
  --filter-terminator=<string>
       Specify <string> to print to stdout following the tags for each file
       parsed when --filter is enabled.
  --links[=(yes|no)]
       Indicate whether symbolic links should be followed [yes].
  --maxdepth=<N>
       Specify maximum recursion depth.
  --recurse[=(yes|no)]
       Recurse into directories supplied on command line [no].
  -R   Equivalent to --recurse.
  -L <file>
       A list of input file names is read from the specified <file>.
       If specified as "-", then standard input is read.
  --append[=(yes|no)]
       Should tags should be appended to existing tag file [no]?
  -a   Append the tags to an existing tag file.
  -f <tagfile>
       Write tags to specified <tagfile>. Value of "-" writes tags to stdout
       ["tags"; or "TAGS" when -e supplied].
  -o   Alternative for -f.

Output Format Options
  --format=(1|2)
       Force output of specified tag file format [2].
  --output-format=(u-ctags|e-ctags|etags|xref|json)
      Specify the output format. [u-ctags]
  -e   Output tag file for use with Emacs.
  -x   Print a tabular cross reference file to standard output.
  --sort=(yes|no|foldcase)
       Should tags be sorted (optionally ignoring case) [yes]?
  -u   Equivalent to --sort=no.
  --etags-include=<file>
       Include reference to <file> in Emacs-style tag file (requires -e).
  --input-encoding=<encoding>
       Specify <encoding> of all input files.
  --input-encoding-<LANG>=<encoding>
       Specify <encoding> of the <LANG> input files.
  --output-encoding=<encoding>
       The <encoding> to write the tag file in. Defaults to UTF-8 if --input-encoding
       is specified, otherwise no conversion is performed.

Language Selection and Mapping Options
  --language-force=(<language>|auto)
       Force all files to be interpreted using specified <language>.
  --languages=[+|-](<list>|all)
       Restrict files scanned for tags to those mapped to languages
       specified in the comma-separated <list>. The list can contain any
       built-in or user-defined language [all].
  --alias-<LANG>=[+|-](<pattern>|default)
       Add a <pattern> detecting a name, can be used as an alternative name
       for <LANG>.
  --guess-language-eagerly
       Guess the language of input file more eagerly
       (but taking longer time for guessing):
       o shebang, even if the input file is not executable,
       o emacs mode specification at the beginning and end of input file, and
       o vim syntax specification at the end of input file.
  -G   Equivalent to --guess-language-eagerly.
  --langmap=<map>[,<map>[...]]
       Override default mapping of language to input file extension.
       e.g. --langmap=c:.c.x,java:+.j,make:([Mm]akefile).mak
  --map-<LANG>=[+|-]<extension>|<pattern>
       Set, add(+) or remove(-) the map for <LANG>.
       Unlike --langmap, this doesn't take a list; only one file name <pattern>
       or one file <extension> can be specified at once.
       Unlike --langmap the change with this option affects mapping of <LANG> only.

Tags File Contents Options
  --excmd=(number|pattern|mix|combine)
       Uses the specified type of EX command to locate tags [mix].
  -n   Equivalent to --excmd=number.
  -N   Equivalent to --excmd=pattern.
  --extras=[+|-][<flags>|*]
       Include extra tag entries for selected information (<flags>: "fFgpqrs") [F].
  --extras-(<LANG>|all)=[+|-][<flags>|*]
       Include <LANG> own extra tag entries for selected information
       (<flags>: see the output of --list-extras=<LANG> option).
  --fields=[+|-][<flags>|*]
       Include selected extension fields (<flags>: "aCeEfFikKlmnNpPrRsStxzZ") [fks].
  --fields-(<LANG>|all)=[+|-][<flags>|*]
       Include selected <LANG> own extension fields
       (<flags>: see the output of --list-fields=<LANG> option).
  --kinds-(<LANG>|all)=[+|-](<kinds>|*)
       Enable/disable tag <kinds> for language <LANG>.
  --pattern-length-limit=<N>
      Cutoff patterns of tag entries after <N> characters. Disable by setting to 0. [96]
  --pseudo-tags=[+|-](<pseudo-tag>|*)
       Enable/disable emitting pseudo tag named <pseudo-tag>.
       if '*' is given, enable emitting all pseudo tags.
  --put-field-prefix
       Put "UCTAGS" as prefix for the name of fields newly introduced in
       universal-ctags.
  --roles-(<LANG>|all).(<kind>|*)=[+|-][<roles>|*]
       Enable/disable tag roles for kinds of language <LANG>.
  --tag-relative=(yes|no|always|never)
       Should paths be relative to location of tag file [no; yes when -e]?
       always: be relative even if input files are passed in with absolute paths
       never:  be absolute even if input files are passed in with relative paths
  -B   Use backward searching patterns (?...?).
  -F   Use forward searching patterns (/.../; default).

Option File Options
  --options=<pathname>
       Specify file (or directory) <pathname> from which command line options should be read.
  --options-maybe=<pathname>
       Do the same as --options but this doesn't make an error for non-existing file.
  --optlib-dir=[+]<directory>
       Add or set <directory> to optlib search path.

optlib Options
  --kinddef-<LANG>=<letter>,<name>,<description>
       Define new kind for <LANG>.
  --langdef=<name>
       Define a new language to be parsed with regular expressions.
  --mline-regex-<LANG>=/<line_pattern>/<name_pattern>/<kind-spec>/[<flags>]
       Define multiline regular expression for locating tags in specific language.
  --regex-<LANG>=/<line_pattern>/<name_pattern>/<kind-spec>/[<flags>]
       Define single-line regular expression for locating tags in specific language.

Language Specific Options
  --if0[=(yes|no)]
       Should code within #if 0 conditional branches be parsed [no]?
  --line-directives[=(yes|no)]
       Should '#line' directives be processed [no]?
  -D <macro>=<definition>
       (CPreProcessor) Give <definition> for <macro>.
  -h (<list>|default)
       Specify a <list> of file extensions to be treated as include files
       [".h.H.hh.hpp.hxx.h++.inc.def"].
  -I [+|-]<list>|@<file>
       A <list> of tokens to be specially handled is read from either the
       command line or the specified <file>.
  --param-<LANG>.<name>=<argument>
       Set <LANG> specific parameter. Available parameters can be listed with --list-params.

Listing Options
  --list-aliases[=(<language>|all)]
       Output list of alias patterns.
  --list-excludes
       Output list of exclude patterns for excluding files/directories.
  --list-extras[=(<language>|all)]
       Output list of extra tag flags.
  --list-features
       Output list of compiled features.
  --list-fields[=(<language>|all)]
       Output list of fields.
  --list-kinds[=(<language>|all)]
       Output a list of all tag kinds for specified <language> or all.
  --list-kinds-full[=(<language>|all)]
       List the details of all tag kinds for specified <language> or all
       For each line, associated language name is printed when "all" is
       specified as language.
  --list-languages
       Output list of supported languages.
  --list-map-extensions[=(<language>|all)]
       Output list of language extensions in mapping.
  --list-map-patterns[=(<language>|all)]
       Output list of language patterns in mapping.
  --list-maps[=(<language>|all)]
       Output list of language mappings (both extensions and patterns).
  --list-mline-regex-flags
       Output list of flags which can be used in a multiline regex parser definition.
  --list-output-formats
       Output list of output formats.
  --list-params[=(<language>|all)]
       Output list of language parameters. This works with --machinable.
  --list-pseudo-tags
       Output list of pseudo tags.
  --list-regex-flags
       Output list of flags which can be used in a regex parser definition.
  --list-roles[=(<language>|all)[.(<kindspecs>|*)]]
       Output list of all roles of tag kind(s) specified for <language>.
       Both letters and names can be used in <kindspecs>.
       e.g. --list-roles=C.{header}d
  --list-subparsers[=(<baselang>|all)]
       Output list of subparsers for the base language.
  --machinable[=(yes|no)]
       Use tab separated representation in --list-* option output. [no]
       --list-{aliases,extras,features,fields,kind-full,langdef-flags,params,
       pseudo-tags,regex-flags,roles,subparsers} support this option.
       Suitable for scripting. Specify before --list-* option.
  --with-list-header[=(yes|no)]
       Prepend the column descriptions in --list- output. [yes]
       --list-{aliases,extras,features,fields,kind-full,langdef-flags,params,
       pseudo-tags,regex-flags,roles,subparsers} support this option.
       Specify before --list-* option.

Miscellaneous Options
  --help
       Print this option summary.
  -?   Print this option summary.
  --help-full
       Print this option summary including experimental features.
  --license
       Print details of software license.
  --print-language
       Don't make tags file but just print the guessed language name for
       input file.
  --quiet[=(yes|no)]
       Don't print NOTICE class messages [no].
  --totals[=(yes|no|extra)]
       Print statistics about input and tag files [no].
  --verbose[=(yes|no)]
       Enable verbose messages describing actions on each input file.
  --version[=<language>]
       Print version identifier of the program to standard output.
       Print version identifier of the parser for <language>.
  -V   Equivalent to --verbose.
Options (86)
OptionDescriptionSource
--exclude patternAdd <pattern> to a list of excluded files and directories.help + man
--exclude-exception patternDon't exclude files and directories matching <pattern> even if they match the pattern specified with --exclude option.help + man
--filter (yes|no)Behave as a filter, reading file names from standard input and writing tags to standard output [no].help
--filter-terminator stringSpecifies a <string> to print to standard output following the tags for each file name parsed when the --filter option is enabled.help + man
--links (yes|no)Indicate whether symbolic links should be followed [yes].help
--maxdepth NLimits the depth of directory recursion enabled with the --recurse (-R) option.help + man
--recurse (yes|no)Recurse into directories supplied on command line [no].help
-REquivalent to --recurse.help + man
-L fileRead from <file> a list of file names for which tags should be generated.help + man
--append (yes|no)Should tags should be appended to existing tag file [no]?help
-aAppend the tags to an existing tag file.help + man
-f tagfileUse the name specified by <tagfile> for the tag file (default is "tags", or "TAGS" when running in etags mode).help + man
-o tagfileEquivalent to "-f tagfile".help + man
--format (1|2)Force output of specified tag file format [2].help + man
--output-format (u-ctags|e-ctags|etags|xref|json)Specify the output format.help + man
-eOutput tag file for use with Emacs.help + man
-xPrint a tabular cross reference file to standard output.help + man
--sort (yes|no|foldcase)Indicates whether the tag file should be sorted on the tag name (default is yes).help + man
-uEquivalent to --sort=no (i.e. "unsorted").help + man
--etags-include fileInclude reference to <file> in Emacs-style tag file (requires -e).help + man
--input-encoding encodingSpecifies the <encoding> of the input files.help + man
--input-encoding- LANG>=<encodingSpecifies a specific input <encoding> for <LANG>.help + man
--output-encoding encodingSpecifies the <encoding> of the tags file.help + man
--language-force (<language>|auto)By default, ctags automatically selects the language of a source file, ignoring those files whose language cannot be determined (see "Determining file language").help + man
--languages +|-](<list>|all)Specifies the languages for which tag generation is enabled, with <list> containing a comma-separated list of language names (case-insensitive;help + man
--alias- LANG>=[+|-](<pattern>|default)Adds ('+') or removes ('-') an alias <pattern> to a language specified with <LANG>.help + man
--guess-language-eagerlyGuess the language of input file more eagerly (but taking longer time for guessing): o shebang, even if the input file is not executable, o emacs mode specification at the beginning and end of input…help + man
-GEquivalent to --guess-language-eagerly.help + man
--langmap mapOverride default mapping of language to input file extension.help
--map- LANG>=[+|-]<extension>|<patternSet, add(+) or remove(-) the map for <LANG>.help
--excmd (number|pattern|mix|combine)Determines the type of EX command used to locate tags in the source file.help + man
-nEquivalent to --excmd=number.help + man
-NEquivalent to --excmd=pattern.help + man
--extras +|-][<flags>|*Include extra tag entries for selected information (<flags>: "fFgpqrs") [F].help
--fields +|-][<flags>|*Include selected extension fields (<flags>: "aCeEfFikKlmnNpPrRsStxzZ") [fks].help
--pattern-length-limit NTruncate patterns of tag entries after <N> characters.help + man
--pseudo-tags +|-](<pseudo-tag>|*)Enable/disable emitting pseudo tag named <pseudo-tag>.help + man
--put-field-prefixPut "UCTAGS" as prefix for the name of fields newly introduced in universal-ctags.help + man
--tag-relative (yes|no|always|never)Specifies how the file paths recorded in the tag file.help + man
-BUse backward searching patterns (e.g. ?pattern?).help + man
-FUse forward searching patterns (e.g. /pattern/) (default).help + man
--options pathnameSpecify file (or directory) <pathname> from which command line options should be read.help + man
--options-maybe pathnameSame as --options but doesn't cause an error if file (or directory) specified with <pathname> doesn't exist.help + man
--optlib-dir +]<directoryAdd or set <directory> to optlib search path.help
--kinddef- LANG>=<letterDefine new kind for <LANG>.help + man
--langdef nameDefines a new user-defined language, <name>, to be parsed with regular expressions.help + man
--mline-regex-Define multiline regular expression for locating tags in specific language.help
--regex-Define single-line regular expression for locating tags in specific language.help
--if0 (yes|no)Should code within #if 0 conditional branches be parsed [no]?help
--line-directives (yes|no)Should '#line' directives be processed [no]?help
-D macro>=<definition(CPreProcessor) Give <definition> for <macro>.help + man
-h (<list>|default)Specifies a <list> of file extensions, separated by periods, which are to be interpreted as include (or header) files.help + man
-I +|-]<list>|@<fileSpecifies a <identifier-list> of identifiers which are to be specially handled while parsing C and C++ source files.help + man
--param- LANG>.<name>=<argumentSet a <LANG> specific parameter, a parameter specific to the <LANG>.help + man
--list-aliases (<language>|all)Output list of alias patterns.help
--list-excludesOutput list of exclude patterns for excluding files/directories.help + man
--list-extras (<language>|all)Output list of extra tag flags.help
--list-featuresOutput list of compiled features.help + man
--list-fields (<language>|all)Output list of fields.help
--list-kinds (<language>|all)Output a list of all tag kinds for specified <language> or all.help
--list-kinds-full (<language>|all)List the details of all tag kinds for specified <language> or all For each line, associated language name is printed when "all" is specified as language.help
--list-languagesLists the names of the languages understood by ctags, and then exits.help + man
--list-map-extensions (<language>|all)Output list of language extensions in mapping.help
--list-map-patterns (<language>|all)Output list of language patterns in mapping.help
--list-maps (<language>|all)Output list of language mappings (both extensions and patterns).help
--list-mline-regex-flagsOutput list of flags which can be used in a multiline regex parser definition.help + man
--list-output-formatsLists the output formats that can be used in --output-format option.help + man
--list-params (<language>|all)Output list of language parameters.help
--list-pseudo-tagsOutput list of pseudo tags.help + man
--list-regex-flagsOutput list of flags which can be used in a regex parser definition.help + man
--list-roles (<language>|all)[.(<kindspecs>|*)Output list of all roles of tag kind(s) specified for <language>.help
--list-subparsers (<baselang>|all)Output list of subparsers for the base language.help
--machinable (yes|no)Use tab separated representation in --list-* option output.help + man
--with-list-header (yes|no)Prepend the column descriptions in --list- output.help
--helpPrints to standard output a detailed usage description, and then exits.help + man
-?Print this option summary.help + man
--help-fullPrints to standard output a detailed usage description including experimental features, and then exits.help + man
--licensePrints a summary of the software license to standard output, and then exits.help + man
--print-languageDon't make tags file but just print the guessed language name for input file.help + man
--quiet (yes|no)Don't print NOTICE class messages [no].help
--totals (yes|no|extra)Print statistics about input and tag files [no].help
--verbose (yes|no)Enable verbose messages describing actions on each input file.help
--version languagePrint version identifier of the program to standard output.help
-VEquivalent to --verbose.help + man
--alias-allThis clears aliases setting of all languages. (in the manual page but not in --help)man
-wThis option is silently ignored for backward-compatibility with the ctags of SVR4 Unix. (in the manual page but not in --help)man

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.