start page | rating of books | rating of authors | reviews | copyrights

UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: Reference: csplitChapter 2
Unix Commands
Next: Reference: ctrace
 

ctags

ctags [options] files

Create a list of function and macro names that are defined in the specified C, Pascal, FORTRAN, yacc, or lex source files. Solaris ctags can also process C++ 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 -f).

Options

-a

Append tag output to existing list of tags.

-B

context uses backward search patterns.

-ftagsfile

Place output in tagsfile (default is tags).

-F

context uses forward search patterns (default).

-t

Include C typedefs as tags.

-u

Update tags file to reflect new locations of functions (e.g., when functions are moved to a different source file). Old tags are deleted; new tags are appended.

-v

Produce a listing (index) of each function, source file, and page number (1 page = 64 lines). -v is intended to create a file for use with vgrind.

-w

Suppress warning messages.

-x

Produce a listing of each function, its line number, source file, and context.

Examples

Store tags in Taglist for all C programs:

ctags -f Taglist *.c

Update tags and store in Newlist:

ctags -u -f Newlist *.c


Previous: Reference: csplitUNIX in a Nutshell: System V EditionNext: Reference: ctrace
Reference: csplitBook IndexReference: ctrace

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System