Linux in a Nutshell, Third Edition
by Ellen Siever, Stephen Spainhour, Jessica P. Hekman, Stephen Figgins
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 contextwhere 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:tagname
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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access