Last active
January 10, 2018 14:48
-
-
Save murarisumit/38a63a11942edaa1bd8c93fb921585b8 to your computer and use it in GitHub Desktop.
Xargs command snippets
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
#list the file opened by process-id | |
ps aux | grep 'index.js' | grep -v 'grep' | awk '{ print $2 }' | xargs -I {} sh -c "lsof -p {}" | |
#list the file opened by process other than specified pid | |
ps aux | grep 'index.js' | grep -v 'grep' | awk '{ print $2 }' | xargs -I {} sh -c "lsof -p ^{}" | |
# list network services by process-id | |
ps aux | grep 'index.js' | grep -v 'grep' | awk '{ print $2 }' | xargs -I {} sh -c "lsof -i | grep {}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment