Created
June 14, 2018 10:14
-
-
Save kartikeyap/a114723e20e55257ec0c5da35b1fb74c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| lsof -P -i tcp | awk '{print $2,$4,$9}' | tr -d 'u' | sort -u| grep -v PID | while read pid fd details; do curr_time="$(date +%s)"; birth_time="$(stat --printf "%Z" /proc/${pid}/fd/${fd})"; age=$((curr_time-birth_time)); if (( $age > 0)); then echo "${age} seconds /proc/${pid}/fd/${fd} ${details}" ; fi; done | sort -n -k1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment