Linux Command Directory
This directory of Linux commands is from Linux in a Nutshell, 5th Edition.
Click on any of the 687 commands below to get a description and list of available options. All links in the command summaries point to the online version of the book on Safari Bookshelf.
Buy it now, or read it online on Safari Bookshelf.
gdb
gdb [options] [program [core|pid] ]
GDB (GNU DeBugger) allows you to step through the execution of a program in order to find the point at which it breaks. It fully supports C and C++, and provides partial support for FORTRAN, Java, Chill, assembly, and Modula-2. The program to be debugged is normally specified on the command line; you can also specify a core or, if you want to investigate a running program, a process ID.
Options
Set line speed of serial device used by GDB to bps.
Exit after executing all the commands specified in .gdbinit and -x files. Print no startup messages.
Consult file for information provided by a core dump.
Use directory as gdb's working directory.
Include directory in path that is searched for source files.
Use file as an executable to be read in conjunction with source code. May be used in conjunction with -s to read the symbol table from the executable.
Show full filename and line number for each stack frame.
Print help message, then exit.
Ignore .gdbinit file.
Suppress introductory and copyright messages.
Consult file for symbol table. With -e, also uses file as the executable.
Set standard in and standard out to device.
Allow gdb to write into executables and core files.
Read gdb commands from file.
Common commands
These are just some of the more common gdb commands; there are too many to list them all.
Print the current location within the program and a stack trace showing how the current location was reached. (where does the same thing.)
Set a breakpoint in the program.
Change the current working directory.
Delete the breakpoint where you just stopped.
List commands to be executed when a breakpoint is hit.
Continue execution from a breakpoint.
Delete a breakpoint or a watchpoint; also used in conjunction with other commands.
Cause variables or expressions to be displayed when program stops.
Move down one stack frame to make another function the current one.
Select a frame for the next continue command.
Show a variety of information about the program. For instance, info breakpoints shows all outstanding breakpoints and watchpoints.
Start execution at another point in the source file.
Abort the process running under gdb's control.
List the contents of the source file corresponding to the program being executed.
Execute the next source line, executing a function in its entirety.
Print the value of a variable or expression.
Show the contents of a datatype, such as a structure or C++ class.
Show the current working directory.
Exit gdb.
Search backward for a regular expression in the source file.
Execute the program.
Search for a regular expression in the source file.
Assign a value to a variable.
Send a signal to the running process.
Execute the next source line, stepping into a function if necessary.
Reverse the effect of the display command; keep expressions from being displayed.
Finish the current loop.
Move up one stack frame to make another function the current one.
Set a watchpoint (i.e., a data breakpoint) in the program.
Print the type of a variable or function.




