Essential Linux and Java Debugging Tools for Rapid Issue Diagnosis
This guide compiles a practical toolbox of Linux commands and Java utilities—including tail, grep, awk, find, tsar, jstack, jmap, jstat, btrace, Greys, JProfiler, and RateLimiter—to help engineers quickly locate, analyze, and resolve performance and stability problems in production environments.
Introduction
In daily work many obscure issues arise, and a set of handy tools can dramatically speed up troubleshooting. This article records useful commands and utilities as a personal notebook and a shared resource.
Linux Command Tools
tail – most commonly used as tail -300f shopbase.log to view the last 300 lines and follow new writes.
grep – various examples for searching files, multiple files, directories, case‑insensitive, include/exclude patterns, and range matching.
awk – basic printing, record numbers, field numbers, and pattern matching examples.
find – examples for searching by name, type, size, permissions, and time attributes across multiple directories.
Specialized Tools
pgm – batch query logs, e.g.,
pgm -A -f vm-shopbase 'cat /home/admin/shopbase/logs/shopbase.log.2017-01-17|grep 2069861630'.
tsar – Alibaba’s own data collection tool for historical and live metrics. Commands: tsar, tsar --live, tsar -d 20161218, and metric‑specific options such as tsar --mem, tsar --cpu.
top – combined with ps -ef | grep java and top -H -p pid to inspect threads.
Java Debugging Utilities
btrace – production‑grade tracing. Example shows how to print stack traces when ArrayList.add is called and the list size exceeds 500.
Greys – provides commands like sc -df xxx for class details and trace class method for method‑level timing.
JProfiler – commercial profiler for deep performance analysis (link provided).
eclipse MAT – memory analysis plugin for Eclipse.
Additional Java Tools
jps – list Java processes with command sudo -u admin /opt/taobao/java/bin/jps -mlvV.
jstack – obtain thread dumps, both standard and native+java stack.
jinfo – view JVM startup flags.
jmap – heap inspection and dump generation.
jstat – monitor GC utilization with jstat -gcutil pid 1000.
jdb – command‑line debugger for remote debugging.
CHLSDB – low‑level JVM debugging tool.
Other Helpful Utilities
maven helper – commands to display dependency trees and resolve conflicts.
VM options – use -XX:+TraceClassLoading or -verbose to trace class loading.
RateLimiter – Guava utility to limit QPS, useful when an upstream service requires a maximum request rate.
System‑Level Checks
When a Java process disappears, sudo dmesg | grep -i kill can reveal OOM‑killer activity. The log shows the process being killed due to memory pressure, and the command to convert dmesg timestamps to real time is provided.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Efficient Ops
This public account is maintained by Xiaotianguo and friends, regularly publishing widely-read original technical articles. We focus on operations transformation and accompany you throughout your operations career, growing together happily.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
