1 Call Tracking
Trace system call Strace ls–l
Trace Library Call Ltrace
2 lsof (list open file)
See what files The program commands open lsof–p PID; Lsof–c CMD
View files opened by a user lsof–u root
See which program a file is accessed by lsof filename
3 proc File system
Virtual file system, you can use cat,more,less to view
For example: Cat/proc/cpuinfo; Cat/proc/meminfo
4 Network debugging
Ping
tcpdump tcpdump–i ETH0–S0–SVX host 192.168.1.12 and Port 1234–w test.pcap
Ethtool
Traceroute
NETSTAT–ANP | grep Port
52 Debugging of binary files
File filename Type
LDD display relies on dynamic library, corresponding library path profile/etc/ld.so.conf, reload command ldconfig
NM lists the symbol information in the target file
Objdump list destination file information, Disassembly objdump–d Hello | More
Readelf Displays elf file information to see if a library defines a function Readelf–s hello.so–w 60 | grep symbol_name
Addr2line the address into the source program name with debug information
6 System Performance View
Top
Vmstat
7. o File View
Find/home/libs–iname "*.*o" –exec sh–c "ls {}; Nm–a {} | Grep–ih "Match_conten" "\;
8 Special Deletions
Under Bash, you can use the extended globbing, boot method: Shopt–s extglob, delete all files except Fie1 and File2 RM! (File1|file2)
Linux program Debugging Common commands