Linux and Unix ctags command

Quick links

About ctags
Syntax
Examples
Related commands
Linux and Unix main page

About ctags

Create a tag file for use with ex and vi.

Syntax

ctags [-a] [-B] [-F] [-t] [-u] [-v] [-w] [-x] [ -f tagsfile ] file

-aAppend output to an existing tags file.
-BUse backward searching patterns (?...?).
-FUse forward searching patterns (/.../) (default).
-tCreate tags for typedefs. /usr/xpg4/bin/ctags creates tags for typedefs by default.
-uUpdate the specified files in tags, that is, all references to them are deleted, and the new values are appended to the file. Beware: this option is implemented in a way which is rather slow; it is usually faster to rebuild the tags file.
-vProduce on the standard output an index listing the function name, file name, and page number (assuming 64 line pages). Since the output will be sorted into lexicographic order, it may be desired to run the output through sort -f.
-wSuppress warning diagnostics.
-xProduce a list of object names, the line number and file name on which each is defined, as well as the text of that line and prints this on the standard output. This is a simple index which can be printed out as an off-line readable function index.
-f tagsfilePlaces the tag descriptions in a file called tagsfile instead of tags the default.
filefile .c Files with basenames ending with the .c suffix are treated as C-language source code.

file .h Files with basenames ending with the .h suffix are treated as C-language source code.

file .f Files with basenames ending with the .f suffix are treated as FORTRAN-language source code.

Examples

ctags -f taglist *.c

Store tags in taglist for all C programs.

Related commands

ex
lex
vgrind
vi
yacc