Problem scenario
You want to use the strace command. How do you use it?
Solution
- Go to a Linux command prompt.
- Run this:
sleep 100 &
- Look at the number the above command produced (e.g., 310222). Craft a command like this (but replace 310222 with the number in the above command):
strace kill 310222
- Run the command drafted above. You should see lines like "openat…" and "kill". In the kill command you will see the returned signal from the kernel (e.g., SIGTERM)
- Run this:
sleep 100 &
- Look at the number the above command produced (e.g., 310222). Craft a command like this (but replace 310222 with the number in the above command):
strace kill -9 310222
- Run the command drafted above. You should see lines like "openat…" and "kill". In the kill command you will see the returned signal from the kernel (e.g., SIGKILL)
FFR
The -9 flag in kill will kill a process; normally kill would just terminate the process.
To learn more about strace, see this external posting.