Linux commands that help me to create a correct environment for debugging

To begin with, I am rather inexperienced Linux developer. All 4 years of commercial development I have used Windows + Visual Studio only. Building software for many platforms is not common for me. So, I created a list of commands (as well as software) and other hints that help me to debug my software on Linux. When I say Linux, it 75% means Mac Os too.

And yes, I am using Ubuntu 8.10.

Gdb

Ctrl+X+A  starts GUI mode.Usually I am debugging code using Netbeans, but there are situations where I need to debug code on remote computer, but installing Netbeans or even set up gdbserver will take too much time. So, I just use Ctrl+X+A keys and gdb switches to simple GUI mode. Very useful

gdb_gui_screen

Ldd

This programs shows library dependencies of some executable file. If the file is not executed for some reason, the first thing we need to check is ldd. In windows the LIB (included with VS) do something like the same.

fuser

Shows who owns the file. In windows I always used Unlocker application for it (installed separately).

dmesg

Shows you the kernel boot messages. Used together with grep. Example:

which

which shows you the full path to the specific executable file, whereis do the same + shows you manuals and sources. Type shows you alias for the command

slocate

Slocate is more generalized version of whitch and whereis. It performs a quick search over database with the list of all files. The database is updated using cron every day. Example:

Leave a Reply

Your email address will not be published. Required fields are marked *