How would you simplify this command?
Posted
by
Andrei Serdeliuc
on Server Fault
See other posts from Server Fault
or by Andrei Serdeliuc
Published on 2012-06-20T15:30:03Z
Indexed on
2012/07/03
21:17 UTC
Read the original article
Hit count: 340
I'm quite new to strace / netstat / etc. I'm using this command to get a trace of the apache process handling my request (telnet), is there a way to simplify it a bit?
sudo strace -o /tmp/strace -f -s4096 -r -p $(netstat -antlp | \
grep $(lsof -p `pidof telnet` | grep TCP | \
perl -n -e'/localhost:(\d+)/ && print $1') | grep apache2 | \
perl -n -e'/ESTABLISHED (\d+)/ && print $1')
Thanks!
© Server Fault or respective owner