Name

ctags

Synopsis

ctags [options] files

Description

Create a list of function and macro names that are defined in the specified C, C++, FORTRAN, Java, Perl, yacc, or other source files. The output list (named tags by default) contains lines of the form:

                  name     file     context

where name is the function or macro name, file is the source file in which name is defined, and context is a search pattern that shows the line of code containing name. After the list of tags is created, you can invoke vi on any file and type:

                  :set tags=
                  tagsfile
                  :tag 
                  name

This switches the vi editor to the source file associated with the name listed in tagsfile (which you specify with -t).

etags produces an equivalent file for tags to be used with Emacs.

Options

-a, --append

Append tag output to existing list of tags.

-d, --defines

Include tag entries for C preprocessor definitions.

-i file, --include= file

Add a note to the tags file that file should be consulted in addition to the normal input file.

-l language, --language= language

Consider the files that follow this option to be written in language. Use the -h option for a list of languages and their default filename extensions.

-o file, --output= file

Write to file.

-r regexp, --regex= regexp

Include a tag for each line that matches regexp in the files following this option.

-R, --no-regex

Don’t include tags based on regular-expression matching for the files that follow this option.

-t, --typedefs

Include tag entries for typedefs.

-u, --update

Update tags ...

Get Linux in a Nutshell, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.