What are diagnostic and debugging tools used for?
To inspect and troubleshoot running processes in Linux.
What do these tools provide?
Real-time visibility into process behavior.
Which tools are included?
/proc/<PID>, pstree, lsof, and strace.</PID>
What does /proc/<PID> directory reveal?</PID>
Information about a specific process.
What details can /proc/<PID> show?</PID>
Command line, environment variables, memory usage, and open file descriptors.
Does /proc/<PID> require additional software?</PID>
No, it is built-in and updates live.
Example of /proc usage?
/proc/2345/status shows memory usage.
Another example of /proc usage?
/proc/2345/cmdline shows how the process was launched.
Why is /proc useful?
Diagnosing resource issues.
What does pstree command do?
Shows hierarchical diagram of processes.
What relationships does pstree display?
Parent and child relationships.
Why use pstree?
To track process lineage and investigate zombie processes.
Option for pstree to include PIDs?
pstree -p.
Example of pstree usage?
Verify if worker processes were respawned correctly after a web app update.
What does lsof command do?
Lists all open files and the processes using them.
What counts as files in Linux?
Sockets, pipes, and devices.
Option for lsof to show network sockets?
lsof -i.
Example of lsof usage for HTTPS?
sudo lsof -iTCP:443 -sTCP:LISTEN shows process listening on HTTPS.
Example of lsof usage for a host?
lsof -i@192.168.1.100 lists connections to a host.
Why use lsof?
Detect port conflicts, identify unauthorized daemons, verify firewall rules, and map network endpoints to PIDs.
What does strace command do?
Hooks into a running process or starts one under trace and logs all system calls.
What system calls does strace log?
open(), read(), write(), connect(), etc.
Example of strace usage?
strace -e open,connect -p 3456 traces access attempts.
Why use strace?
To find missing files, detect misconfigured permissions, diagnose subtle I/O errors, and gain detailed insight beyond logs.