Skip to content

Instantly share code, notes, and snippets.

@fasterthanlime
Created June 9, 2018 14:57
Show Gist options
  • Save fasterthanlime/d487cb4d51184c9b3cae8a5125f724d0 to your computer and use it in GitHub Desktop.
Save fasterthanlime/d487cb4d51184c9b3cae8a5125f724d0 to your computer and use it in GitHub Desktop.

Sample command:

strace -f -e trace=execve -- bash -c "echo hey && cat /dev/null && yes | head -2" > /dev/null

Sample output:

execve("/bin/bash", ["bash", "-c", "echo hey && cat /dev/null && yes"...], [/* 98 vars */]) = 0
strace: Process 7250 attached
[pid  7250] execve("/bin/cat", ["cat", "/dev/null"], [/* 97 vars */]) = 0
[pid  7250] +++ exited with 0 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=7250, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
strace: Process 7251 attached
strace: Process 7252 attached
[pid  7251] execve("/usr/bin/yes", ["yes"], [/* 97 vars */] <unfinished ...>
[pid  7252] execve("/usr/bin/head", ["head", "-2"], [/* 97 vars */]) = 0
[pid  7251] <... execve resumed> )      = 0
[pid  7251] --- SIGPIPE {si_signo=SIGPIPE, si_code=SI_USER, si_pid=7251, si_uid=1000} ---
[pid  7251] +++ killed by SIGPIPE +++
[pid  7252] +++ exited with 0 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_KILLED, si_pid=7251, si_uid=1000, si_status=SIGPIPE, si_utime=0, si_stime=0} ---
+++ exited with 0 +++
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment