Skip to content

Instantly share code, notes, and snippets.

@netman69
Created March 25, 2018 22:23
Show Gist options
  • Save netman69/43d89ae42333f91c01e938e6e6d1371b to your computer and use it in GitHub Desktop.
Save netman69/43d89ae42333f91c01e938e6e6d1371b to your computer and use it in GitHub Desktop.
show what processes launched the shell with sh oneliner
sh -c "cur=\$\$; while true; do cur=\"`ps -o ppid= -p \$cur | sed -e 's/^ *//g'`\"; exe=\"`readlink /proc/\$cur/exe`\"; echo \$exe; test -z \"\$exe\" && break; done" | awk '{ a[i++] = $0 } END { for (j = i - 2; j >= 0;) print a[j--] }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment