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

-a Append output to an existing tags file.
-B Use backward searching patterns (?...?).
-F Use forward searching patterns (/.../) (default).
-t Create tags for typedefs. /usr/xpg4/bin/ctags creates tags for typedefs by default.
-u Update 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.
-v Produce 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.
-w Suppress warning diagnostics.
-x Produce 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 tagsfile Places the tag descriptions in a file called tagsfile instead of tags the default.
file file .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