Linux program Debugging Common commands

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.