Skip to content

Instantly share code, notes, and snippets.

@mikemackintosh
Last active December 6, 2016 07:16
Show Gist options
  • Save mikemackintosh/e657c44a82b10ea49d3e to your computer and use it in GitHub Desktop.
Save mikemackintosh/e657c44a82b10ea49d3e to your computer and use it in GitHub Desktop.
PID=$(ps aux |\
grep `w | \
grep -E "\s(tty.*?|console.*?)\s" | \
awk '{print $2}'` | \
grep -v "grep" | \
awk '{print $2}')
sudo strace -p$PID -s9999 -e write,read
sudo script /dev/console
# sudo script -f /dev/console
→ w
15:18 up 11 days, 22:53, 4 users, load averages: 1.61 1.62 1.51
USER TTY FROM LOGIN@ IDLE WHAT
root console - 31Jan15 111days -bash
splug pts/1 - Fri10 16:47 ruby /Users/splug/workspace/git/titan-cronus/vendor/bundle/ruby/2.1.0/bin/shotgun
splug pts/2 - 05Feb15 6:18 -bash
splug pts/3 - 10:33 - w
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment