OnWorks favicon

global - Online in the Cloud

Run global in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

This is the command global that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator



global - print the locations of specified object.


global [-aGilnqrstTvx][-e] pattern
global -c[qrsv] prefix
global -f[anqrstvx] files
global -g[aGilnoOqtvx][-e] pattern
global -I[ailnqtvx][-e] pattern
global -P[aGilnoOqtvx][-e] pattern
global -p[qrv]
global -u[qv]


Global find the locations of specified object in C, C++, Yacc, Java, PHP and Assembly
source files. Global can treat a source tree, that is, a directory that has sub-
directories and source files as a project. You can get the relative path of objects from
anywhere within the project. Global can locate not only object definitions but also
object references and other symbols.

In advance of using this command, you must execute gtags(1) at the root directory of the
project to make tag files. Then you can execute this command at anywhere in the project.


The following commands are available:

<no command> pattern
Print object which match to the pattern. Extended regular expressions which are
the same as those accepted by egrep(1) are available.

-c, --completion [prefix]
Print the candidates of object names which start with the specified prefix. Prefix
is not specified, print all object names.

-f, --file files
Print all tags in the files. This option implies the -x option.

-g, --grep pattern
Print all lines which match to the pattern.

--help Show help.

-I, --idutils pattern
Print all lines which match to the pattern. This function use idutils(1) as a
search engine. To use this command, you need to install idutils(1) in your system
and you must execute gtags(1) with the -I option.

-P, --path [pattern]
Print the paths which match to the pattern. If no pattern specified, print all
paths in the project.

-p, --print-dbpath
Print the location of ´GTAGS´.

-u, --update
Locate tag files and update them incrementally.

Show version number.


The following options are available:

-a, --absolute
Print absolute path name. By default, print relative path name.

--from-here context
Decide tag type by the context. The context must be 'lineno:path'. If this option
is specified then the -s and -r are ignored. Regular expression is not allowed in
the pattern. This option is assumes use in conversational environments such as
editors and IDEs.

-e, --regexp pattern
Use pattern as the pattern; useful to protect patterns beginning with ´-´.

-G, --basic-regexp
Interpret pattern as a basic regular expression. The default is extended regular

-i, --ignore-case
ignore case distinctions in pattern.

-l, --local
Print just objects which exist under the current directory.

-n, --nofilter
Suppress sort filter and path conversion filter.

-O, --only-other
Search pattern only in other than source files like ´README´. This option is valid
only with -g or -P command. This option override the -o option.

-o, --other
Search pattern in not only source files but also other files like ´README´. This
option is valid only with -g or -P command.

-q, --quiet
Quiet mode.

-r, --reference, --rootdir
Print the locations of object references. By default, print object definitions.
With the -p option, print the root directory of source tree.

--result format
format may be 'path', `ctags', `ctags-x', `grep' or 'cscope'. The --result=ctags
and --result=ctags-x are equivalent to the -t and -x respectively. The --result
option is given to priority more than the -t and -x option.

-s, --symbol
Print the locations of specified symbol other than definitions.

-T, --through
Go through all the tag files listed in GTAGSLIBPATH. By default, stop searching
when tag is found. This option is ignored when either -s, -r or -l option is

-t, --tags
Print with standard ctags format.

-v, --verbose
Verbose mode.

-x, --cxref
In addition to the default output, produce the line number and the line contents.


$ ls -F
Makefile src/ lib/
$ gtags
$ global main
$ global -x main
main 10 src/main.c main (argc, argv) {
$ global -x '^[sg]et'
set_num 20 lib/util.c set_num(values)
get_num 30 lib/util.c get_num() {
$ global -rx '^[sg]et'
set_num 113 src/op.c set_num(32);
set_num 225 src/opop.c if (set_num(0) > 0) {
get_num 90 src/op.c while (get_num() > 0) {
$ cd lib
$ global -rx '^[sg]et'
set_num 113 ../src/op.c set_num(32);
set_num 225 ../src/opop.c if (set_num(0) > 0) {
get_num 90 ../src/op.c while (get_num() > 0) {
$ global strlen
$ (cd /usr/src/sys; gtags)
$ export GTAGSLIBPATH=/usr/src/sys
$ global strlen
$ (cd /usr/src/lib; gtags)
$ GTAGSLIBPATH=/usr/src/lib:/usr/src/sys
$ global strlen

Use global online using onworks.net services

Free Servers & Workstations

Download Windows & Linux apps

  • 1
    A set of Python extension modules that
    wrap the cross-platform GUI classes from
    wxWidgets.. Audience: Developers. User
    interface: X Window System (X11), Win32 ...
    Download wxPython
  • 2
    This is the Total War pack file manager
    project, starting from version 1.7. A
    short introduction into Warscape
    modding: ...
    Download packfilemanager
  • 3
    A network traffic tool for measuring
    TCP and UDP performance with metrics
    around both throughput and latency. The
    goals include maintaining an active
    iperf cod...
    Download IPerf2
  • 4
    fre:ac - free audio converter
    fre:ac - free audio converter
    fre:ac is a free audio converter and CD
    ripper for various formats and encoders.
    It features MP3, MP4/M4A, WMA, Ogg
    Vorbis, FLAC, AAC, and Bonk format
    support, ...
    Download fre:ac - free audio converter
  • 5
    Write your chatbot logic once and
    connect it to one of the available
    messaging services, including Amazon
    Alexa, Facebook Messenger, Slack,
    Telegram or even yo...
    Download BotMan
  • 6
    gerbv  a Gerber (RS-274X) viewer
    gerbv a Gerber (RS-274X) viewer
    Gerbv is an open source Gerber file
    (RS-274X only) viewer. Gerbv lets you
    load several files on top of each other,
    do measurements on the displayed image,
    etc. ...
    Download gerbv a Gerber (RS-274X) viewer
  • 7
    I/O performance Analysis Tool.
    Audience: Developers, Information
    Technology, Science/Research, System
    Administrators. User interface: Win32
    (MS Windows). Progr...
    Download Iometer
  • More »

Linux commands