Last active
September 1, 2017 02:32
-
-
Save pansen/69fed4d3879369adc30c to your computer and use it in GitHub Desktop.
shell notes
This file contains 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
# http://superuser.com/a/305141 | |
# http://askubuntu.com/a/63203 | |
`GZIP=-9 tar --use-compress-program=pigz -czvf foo.tgz foo` | |
# inspect `php5-fpm` (or anything else) | |
strace -E trace=open,read,write,readv,writev,recv,recvfrom,send,sendto -s 999 $(ps axu|grep php-fpm|awk ' { print $2 } ' | xargs -i echo -n ' -p {}') | |
# inspect the interesting parts on php-fpm on the wire (assuming its listening to port 9000 or 9001) | |
SELECT='port 9000 or port 9001'; CUT_AT=400; ngrep -Wbyline -dany -q "" $SELECT \ | |
| grep -E '\[AP?\]$' -A19 \ | |
| grep -E '^[A-Z].{1,30}: ' -B3 -A5 \ | |
| sed -e '/.\{'"${CUT_AT}"'\}/ s/^\(.\{400\}\).*$/\1 @@@__truncated__@@@/' | |
# open file handles by process name | |
lsof -a $(ps axu|grep php-fpm|awk ' { print $2 } ' | xargs -i echo -n ' -p {}') | wc -l | |
# disk usage with iuse | |
df -h --output=source,target,ipcent,pcent | |
df -hi | |
# find inodes used per dir | |
# http://unix.stackexchange.com/a/117094 | |
find / -xdev -printf '%h\n' | sort | uniq -c | sort -k 1 -n | |
# uninstall macports package recursively (with dependencies) | |
sudo port -v uninstall --follow-dependents xxx | |
# identify leaking processes | |
ps --sort -rss -eo rss,pid,command | head |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment