produce tags file for ex, more and vi 



ctags [-aBFwx] [-f tagfile] sourcefile...


By default, ctags generates a file named tags in the current directory which summarizes the locations of various objects in the C or FORTRAN sourcefiles named on the command line. All files with a .c or .h suffix are treated as C source files, while files with a .f suffix are treated as FORTRAN source files. For C source code, ctags summarizes function, macro and typedef definitions. For FORTRAN source code, it summarizes function and subroutine definitions. See tags for a description of the format of the tags file.

You can access the tags file with the -t name option in ex, more, and vi, the command

:tag \fIname\fP

in ex and vi, and the command


in more. The idea is that you tell the utility which function you want to look at and it checks the tags file to determine which source file contains the function.

ctags makes special provision for the function main() which may occur in several C source files. The tags file contains an entry for the first main() routine found. For all occurrences of main() (including the first), the tags file also contains an entry for Mname, where name is the name of the input sourcefile, with the .c suffix and any leading path name components removed. For example, a tags file created for a C source code file named file.c would contain an entry for Mfile which represents the main() routine in file.c.

ctags uses sort to sort the file by tag name, according to the POSIX locale's collation sequence.



appends output to the existing tags file rather than overwriting the file.


produces a tags file that searches backward from the current position to find the pattern matching the tag.


searches for tag patterns in the forward direction (default).

-f tagfile 

generates a file named tagfile rather than the default tags.


suppresses warning messages.


produces a human-readable report on the standard output. The report gives the definition name, the line number of where it appears in the file, the name of the file in which it appears and the text of that line. ctags arranges this output in columns and sorts it in order by tag name according to the current locale's collation sequence. This option does not produce a tags file.



output tags file


Possible exit status values are:


Successful completion.


Failure due to any of the following:

— unknown command line option
— cannot create the output file
— cannot open the output file
— one of the input files was unrecognized


POSIX.2. x/OPEN Portability Guide 4.0. 4.2 BSD UNIX and up. Windows 8.1. Windows Server 2012 R2. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022.

The -B, -F and -w options are extensions to the POSIX and XPG standards.


Recognizing a function definition in C source code can be somewhat difficult. Since ctags does not know which C preprocessor symbols are defined, there may be some misplaced function definition information if sections of code within #if...#endif are not complete blocks.

ctags invokes the sort command internally. Be sure that ctags does not access the Windows sort command instead of the sort provided with PTC MKS Toolkit; otherwise, ctags fails. Modify your path search rules if you have this problem.


PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


more, sort, vi

File Formats:

PTC MKS Toolkit 10.4 Documentation Build 39.