LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

cscope

source code browsing tool for C, C++, and Java

TLDR

Build database for current directory
$ cscope -b
copy
Start interactive mode
$ cscope
copy
Build database for C files recursively
$ cscope -bR
copy
Build with specific files
$ cscope -b -i [cscope.files]
copy
Search for symbol
$ cscope -L0 [symbol]
copy
Find function definition
$ cscope -L1 [function]
copy
Find functions calling function
$ cscope -L3 [function]
copy

SYNOPSIS

cscope [options] [files]

DESCRIPTION

cscope is a source code browsing tool for C, C++, and Java. It builds a database of symbols, function definitions, and references, enabling fast navigation through large codebases.The interactive interface allows searching for symbol definitions, function callers and callees, text strings, and file inclusions. It integrates with editors like vim and emacs for seamless code navigation.

PARAMETERS

-b

Build database only (don't start interface).
-R
Recurse directories for source files.
-q
Build inverted index for faster searches.
-i file
Read file list from file.
-s dir
Search additional directories.
-d
Don't update database.
-L n pattern
Line-oriented search (n=search type).
-f file
Use specified database file.
-p n
Display last n path components.

CONFIGURATION

cscope.files

List of files to include in the database.

SEARCH TYPES

0: Find symbol1: Find definition2: Find functions called by3: Find functions calling4: Find text string5: Change text string (egrep)6: Find file7: Find files including

CAVEATS

Database needs rebuilding after code changes. Works best with C-style languages. Large codebases may have slow initial indexing. Some modern features may confuse parser.

HISTORY

cscope was developed at Bell Labs in the 1980s by Joe Steffen. It was part of the Programmer's Workbench and became widely used for navigating Unix source code. Though older tools exist now, cscope remains popular for its speed and vim integration.

SEE ALSO

ctags(1), vim(1), grep(1), global(1)

Copied to clipboard
Kai