How would you simplify this command?
- by Andrei Serdeliuc
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!