Debugging in Linux is essential for troubleshooting system issues, application bugs, or network problems. Here’s a simple guide to get you started with common Linux debugging tools and techniques.
1. Checking System Logs
Linux logs are a great starting point for debugging. Logs capture events related to the kernel, applications, and services.
View Logs with journalctl
# List all processesps aux# View processes in real-timetop
Find a Process by Name with pgrep
pgrep <process_name>
Debug a Process with strace
strace traces system calls made by a process.
strace -p <pid>`
Debug a Process with gdb
gdb is used for debugging compiled applications.
gdb <program_name> <pid>
- Networking DebuggingCheck Active Connections with netstat or ss
Using netstat
netstat -tuln
Using ss
ss -tuln
Test Connectivity with ping or curl
ping <hostname_or_ip>
curl -v http://
Check Firewall Rules with iptables or ufw
Using iptables
sudo iptables -L -v
Using ufw
sudo ufw status verbose
- Disk and Filesystem DebuggingCheck Disk Usage with df and du
Disk space usage
df -h
Directory size usage
du -sh <directory_name>
Check Disk Health with fsck and smartctl
Check and repair filesystem (run in unmounted mode)
sudo fsck /dev/sdX
Check disk health using smartctl
sudo smartctl -a /dev/sdX
- Memory DebuggingCheck Memory Usage with free and vmstat
Memory usage
free -h
System performance and memory statistics
vmstat 1 5
Analyze Memory Leaks with valgrind
valgrind --leak-check=yes ./your_program
- Kernel DebuggingCheck Kernel Messages with dmesg
dmesg | tail
Debug Kernel Panics with kdump
Ensure kdump is installed and configured for capturing kernel crash dumps.
sudo systemctl start kdump
Conclusion
Effective debugging in Linux requires a good understanding of system logs, processes, network, disk, and memory. Start with logs, monitor processes, trace system calls, and analyze system resources. Mastering these tools will help you quickly diagnose and resolve issues.
Top comments(1)

- LocationIndia
- EducationRTU/AMU
- WorkSr. Technical Manager @ VOIS
- Joined
Good one!
For further actions, you may consider blocking this person and/orreporting abuse