{"id":18,"date":"2023-06-10T12:02:32","date_gmt":"2023-06-10T04:02:32","guid":{"rendered":"https:\/\/www.waidts.com\/?p=18"},"modified":"2023-06-13T09:45:52","modified_gmt":"2023-06-13T01:45:52","slug":"linux%e9%81%8b%e7%b6%ad%e5%b8%b8%e7%94%a8%e5%91%bd%e4%bb%a4","status":"publish","type":"post","link":"https:\/\/www.waidts.com\/index.php\/2023\/06\/10\/linux%e9%81%8b%e7%b6%ad%e5%b8%b8%e7%94%a8%e5%91%bd%e4%bb%a4\/","title":{"rendered":"Linux\u904b\u7dad\u5e38\u7528\u547d\u4ee4"},"content":{"rendered":"\n<p>Nginx<br>\/usr\/local\/nginx\/sbin\/nginx -s reload\u00a0\u00a0 \u91cd\u555fnginx<br>\/usr\/local\/nginx\/sbin\/nginx                  \u555f\u52d5nginx<\/p>\n\n\n\n<p>Network<br>telnet 47.90.45.137 9091&nbsp;&nbsp; ping\u6307\u5b9a\u57e0\u662f\u5426\u901a<\/p>\n\n\n\n<p>Port<br>firewall-cmd &#8211;list-ports \u67e5\u770b\u5c0d\u5916\u958b\u653e\u7684\u6240\u6709\u57e0<br>netstat -ntulp |grep 8880 \u67e5\u770b8880\u57e0\u662f\u5426\u555f\u52d5<br>netstat -nat|grep -i \u201c80\u201d|wc -l \u67e5\u770b\u6307\u5b9a80\u57e0\u7684\u63a7\u5236\u78bc\u6578<br>firewall-cmd &#8211;permanent &#8211;zone=public &#8211;add-port=8080\/tcp \u958b\u653e\u6307\u5b9a\u57e0<br>systemctl reload firewalld \u91cd\u555f\u9632\u706b\u7246<\/p>\n\n\n\n<p>Process<br>netstat -nap | grep 30754 \u67e5\u770b\u6307\u5b9a\u9032\u7a0b\u4f54\u7528\u57e0<br>netstat -an | grep 8101 \u67e5\u770b\u6307\u5b9a\u57e0\u4f54\u7528\u9032\u7a0b<br>netstat -anpt | grep LISTEN | grep 3658 \u67e5\u770b\u6307\u5b9a\u57e0\u4f54\u7528\u9032\u7a0b<\/p>\n\n\n\n<p>File<br>du -h \u2013max-depth=1 * \u67e5\u770b\u7576\u524d\u8def\u5f91\u4e0b\u5404\u500b\u6a94\u5927\u5c0f<br>du -h * \u5217\u51fa\u7576\u524d\u6bcf\u500b\u8cc7\u6599\u593e\u5927\u5c0f<br>Find \/ -name \u2018filename\u2019 \/\u76ee\u9304\u4e0b\u641c\u7d22\u6307\u5b9a\u6a94\u8def\u5f91<br>sed -n \u20181021960,1023960p\u2019 info.log \u67e5\u770b\u6307\u5b9a\u884c\u7bc4\u570d\u7684\u8cc7\u8a0a<br>cat info.log |grep -n -A10 -B200 \u201ce15227019222@163.com\u201d<br>\u67e5\u770b\u6307\u5b9a\u8cc7\u8a0a\u51fa\u73fe\u7684 \u4e0a\u4e0b\u591a\u5c11\u884c<br>netstat -n | awk \u2018\/^tcp\/ {++state[$NF]} END {for(key in state) print key,&#8221;\\t&#8221;,state[key]}\u2019<br>\u67e5\u770btcpip\u9023\u63a5\u6578<\/p>\n\n\n\n<p>Occupy<br>ps aux | head -1;ps aux |grep -v PID |sort -rn -k +4 | head -30<br>\u4f7f\u7528ps\u547d\u4ee4\u627e\u51fa\u4f54\u7528\u8a18\u61b6\u9ad4\u8cc7\u6e90\u6700\u591a\u768430\u500b\u9032\u7a0b<br>ps -eo pmem,pcpu,rss,vsize,args | sort -k 1 -n -r | less<br>\u67e5\u770b\u9032\u7a0b\u4f54\u7528\u7684\u5be6\u969b\u5be6\u9ad4\u8a18\u61b6\u9ad4\uff08\u5f9e\u5927\u5230\u5c0f\uff09<br>pmap -x 32462 \u67e5\u770b\u5177\u9ad4\u9032\u7a0b\u4e0b\u8a73\u7d30\u7684\u8a18\u61b6\u9ad4\u4f7f\u7528\u60c5\u6cc1<br>jmap -dump:format=b,file=\/app\/fkex\/dump\/dump.out 32227 \u6307\u5b9a\u9032\u7a0b\u751f\u6210dump\u5806\u8cc7\u8a0a<\/p>\n\n\n\n<p>Performance<br>CPU\u4f54\u7528\u6700\u591a\u7684\u524d10\u500b\u9032\u7a0b ps auxw|head -1;ps auxw|sort -rn -k3|head -10<br>\u8a18\u61b6\u9ad4\u6d88\u8017\u6700\u591a\u7684\u524d10\u500b\u9032\u7a0b ps auxw|head -1;ps auxw|sort -rn -k4|head -10<br>\u865b\u64ec\u8a18\u61b6\u9ad4\u4f7f\u7528\u6700\u591a\u7684\u524d10\u500b\u9032\u7a0b ps auxw|head -1;ps auxw|sort -rn -k5|head -10<\/p>\n\n\n\n<p>%MEM \u9032\u7a0b\u7684\u8a18\u61b6\u9ad4\u4f54\u7528\u7387<br>MAJFL is the major page fault count,<br>VSZ \u9032\u7a0b\u6240\u4f7f\u7528\u7684\u865b\u5b58\u7684\u5927\u5c0f<br>RSS \u9032\u7a0b\u4f7f\u7528\u7684\u99d0\u7559\u96c6\u5927\u5c0f\u6216\u8005\u662f\u5be6\u969b\u8a18\u61b6\u9ad4\u7684\u5927\u5c0f<br>(RSS is the \u201cresident set size\u201d meaning physical memory used)<br>TTY \u8207\u9032\u7a0b\u95dc\u806f\u7684\u7d42\u7aef\uff08tty\uff09<\/p>\n\n\n\n<p>View broadband<br>\u5b89\u88dd\u5916\u639b\u7a0b\u5f0f\uff1ayum install libpcap nethogs<br>\u57f7\u884c\u547d\u4ee4\uff1anethogs<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Nginx\/usr\/local\/nginx\/sbin\/nginx -s reload\u00a0\u00a0 \u91cd\u555fnginx\/us &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/www.waidts.com\/index.php\/2023\/06\/10\/linux%e9%81%8b%e7%b6%ad%e5%b8%b8%e7%94%a8%e5%91%bd%e4%bb%a4\/\"> <span class=\"screen-reader-text\">Linux\u904b\u7dad\u5e38\u7528\u547d\u4ee4<\/span> \u95b1\u8b80\u5168\u6587 &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","footnotes":""},"categories":[3],"tags":[],"class_list":["post-18","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.waidts.com\/index.php\/wp-json\/wp\/v2\/posts\/18","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.waidts.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.waidts.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.waidts.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.waidts.com\/index.php\/wp-json\/wp\/v2\/comments?post=18"}],"version-history":[{"count":7,"href":"https:\/\/www.waidts.com\/index.php\/wp-json\/wp\/v2\/posts\/18\/revisions"}],"predecessor-version":[{"id":30,"href":"https:\/\/www.waidts.com\/index.php\/wp-json\/wp\/v2\/posts\/18\/revisions\/30"}],"wp:attachment":[{"href":"https:\/\/www.waidts.com\/index.php\/wp-json\/wp\/v2\/media?parent=18"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.waidts.com\/index.php\/wp-json\/wp\/v2\/categories?post=18"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.waidts.com\/index.php\/wp-json\/wp\/v2\/tags?post=18"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}