Ten Commands Every Linux Developer Should Know

A few simple utilities can make it easier to figure out and maintain other people's code.
10. objdump

This is a more advanced tool and is not for the faint of heart. It's sort of a data-mining tool for object files. A treasure trove of information is encoded inside your object code, and this tool lets you see it. One useful thing this tool can do is dump assembly code mixed with source lines, something gcc -S doesn't do for some reason. Your object code must be compiled with debug (-g) for this to work:

objdump --demangle --source myobject.o

objdump also can help extract binary data from a core file for postmortem debug when you don't have access to a debugger. A complete example is too long for this article, but you need the virtual address from nm or obdump -t. Then, you can dump the file offsets for each virtual address with objdump -x. Finally, objdump is able to read from non-ELF file formats that gdb and other tools can't touch.

This article is not intended as a definitive reference but as a starting point to help you become more productive. Each one of these commands is well documented in the Linux man and info pages. Consult them for more information and more ideas.

Resources for this article: /article/7658.

John Fusco is a software developer with General Electric Healthcare (formerly GE Medical Systems), where he designs Linux software and device drivers for GE's Lightspeed series of Computed Tomography scanners (www.gemedicalsystems.com/rad/ct/products/light_series/index.html).

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

CRASH

flostre's picture

In its current version, this page crashes Konqueror 3.5.5.

great for interviews

ak_boy's picture

absolutely fantastico quick summary for interviews ... especially when people ask you to name your favorite unix/linux commands ... believe me, "they" do ...

Great article

Anonymous's picture

This is the stuff I look for in LJ Magazine.
Kudos to Mr Fusco!

a few more

undefined's picture

many of your commands are more beneficial to system administrators than programmers, imho (as i wear both hats), so i add the following:

lsof
netstat
ethereal

lsof is the opposite of fuser: instead of what processes have open a file, it tells what files a process has open.

netstat tells what ports are bound to, and will even list the specific processes if you own them.

for debugging network applications, nothing beats ethereal. it's the strace of networking.

i really enjoyed the article and learned some new things (fuser, od, xxd). it's general articles like these (applicable to any serious linux user) that keeps me subscribed to the dead-tree lj.

what is equivalent of

Anonymous's picture

what is equivalent of "pstack" to view a core file in Linux.

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState