tr "\0" " " < /proc/1234/cmdline; echoPrint the null-separated command line from /proc.
Low-level Linux process inspection with /proc, syscall tracing, profilers, debuggers, and core dumps.
Use /proc for low-level process inspection.
tr "\0" " " < /proc/1234/cmdline; echoPrint the null-separated command line from /proc.
tr "\0" "
" < /proc/1234/environ | headInspect environment variables of a process when permitted.
ls -l /proc/1234/fd | headInspect file descriptors directly from procfs.
cat /proc/1234/limitsDisplay RLIMIT values for a process.
head -40 /proc/1234/mapsInspect mapped memory regions and permissions.
head -80 /proc/1234/smapsInspect detailed per-region memory accounting.
sudo cat /proc/1234/stackInspect a sleeping task kernel stack when permitted.
cat /proc/1234/sched | head -40Inspect scheduling statistics and vruntime data.
Trace syscalls, signals, and shared-library calls.
strace -o trace.log ./programTrace syscalls made by a new command.
sudo strace -p 1234Attach to a live process and trace syscalls.
strace -ff -o trace ./serverWrite one trace file per process and follow forks.
strace -e trace=network -p 1234Focus on network-related system calls only.
strace -e trace=file -p 1234Focus on file and pathname operations.
ltrace -o ltrace.log ./programTrace dynamic library calls if ltrace is installed.
sudo perf topSample hot functions on the system in real time.
sudo perf record -p 1234 -- sleep 30Collect CPU samples for one PID over time.
sudo perf reportAnalyze a perf recording interactively.
Attach debuggers and work with core files.
gdb -p 1234Attach a debugger to a running process.
gdb -batch -ex "thread apply all bt" -p 1234Collect all-thread backtraces from a live process.
coredumpctl listList core dumps managed by systemd-coredump.
coredumpctl gdb 1234Load the newest core dump for a PID into gdb.
ulimit -c unlimitedAllow the shell to generate core dumps.