Linux debugging command (리눅스 디버깅 커맨드)
2025. 2. 22. 03:41ㆍEmbedded Development
Linux Debugging Commands You Should Know
1. Checking Process and System Status
top
/htop
: Monitor real-time process CPU and memory usageps aux
: View a list of running processespidstat
: Analyze CPU usage of a specific processvmstat
: Monitor system performance and resource usageiostat
: Check disk I/O statusfree -m
: Check memory usageuptime
: Display system uptime and load average
2. Checking and Analyzing Logs
dmesg | less
: View kernel logs (boot, drivers, hardware issues, etc.)journalctl -xe
: View system logs (for systemd-based environments)tail -f /var/log/syslog
: Monitor system logs in real-timecat /var/log/messages
: View general system logsgrep "error" /var/log/syslog
: Search logs for specific keywords
3. Network Debugging
ping <IP>
: Check network connectivitytraceroute <IP>
: Trace network routenetstat -tulnp
: View open ports and network connectionsss -tulnp
: Faster alternative tonetstat
lsof -i :<port>
: Check which process is using a specific porttcpdump -i eth0 port 80
: Capture network packetswireshark
: GUI-based network packet analysis toolifconfig
/ip a
: Check network interface status
4. File and Directory Debugging
ls -lah
: Display detailed file and directory informationstat <filename>
: Check file attributes and timestampsdf -h
: Check disk usagedu -sh <directory>
: Check the size of a specific directoryfind /path -name "*.log"
: Search for specific filesinotifywait -m <file>
: Monitor real-time file changes
5. Memory and Process Debugging
strace -p <PID>
: Trace system calls of a processltrace -p <PID>
: Trace library function calls of a processgdb <executable>
: Debug programs with GNU Debuggervalgrind --leak-check=full ./program
: Detect memory leakspmap -x <PID>
: Check memory mapping of a processcat /proc/<PID>/maps
: View memory mapping details
6. File System and Disk Checking
fsck /dev/sdX
: Check and repair filesystem errorsmount | grep <directory>
: Check mounted filesystemsblkid
: Check disk UUID and typehdparm -I /dev/sdX
: Get disk informationsmartctl -a /dev/sdX
: Check S.M.A.R.T. disk health status
7. CPU and Performance Profiling
perf top
: Monitor real-time CPU performanceperf record -g ./program && perf report
: Performance analysis and reportingtime ./program
: Measure execution timempstat -P ALL
: Check per-core CPU usage
8. Kernel Debugging
cat /proc/cpuinfo
: Check CPU informationcat /proc/meminfo
: Check memory informationlsmod
: View loaded kernel modulesmodinfo <module_name>
: Get details of a specific kernel moduleinsmod <module.ko>
/rmmod <module_name>
: Load and unload kernel modules
9. Debugging Tools
gdb
: GNU Debuggervalgrind
: Memory leak detection and performance analysis toolrr
: Reverse debugging toolSystemTap
: Dynamic kernel analysis toolbpftrace
: eBPF-based performance analysis
Using these commands depending on your debugging needs will help you troubleshoot issues effectively! 🚀
'Embedded Development' 카테고리의 다른 글
Using Git Bash: Clone, Modify, and Push Code to a Repository (0) | 2025.04.25 |
---|---|
I2S (Inter-IC Sound) Protocol (0) | 2025.02.28 |
I2C / UART / SPI / CAN 통신 프로토콜 비교 (0) | 2025.02.22 |