{"id":181421,"date":"2020-05-16T10:11:38","date_gmt":"2020-05-16T02:11:38","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=181421"},"modified":"2020-05-06T10:12:52","modified_gmt":"2020-05-06T02:12:52","slug":"process-analysis-under-linux","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/process-analysis-under-linux.html","title":{"rendered":"Linux\u4e0b\u7684\u8fdb\u7a0b\u5206\u6790–PS"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | \u5f53\u6211\u4eec\u5728Linux\u7cfb\u7edf\u4e0b\u8981\u5bf9\u8fdb\u7a0b\u8fdb\u884c\u76d1\u6d4b\u548c\u63a7\u5236\u65f6\uff0c\u9996\u5148\u5fc5\u987b\u8981\u4e86\u89e3\u5f53\u524d\u8fdb\u7a0b\u7684\u60c5\u51b5,\u4e5f\u5c31\u662f\u9700\u8981\u67e5\u770b\u5f53\u524d\u8fdb\u7a0b\uff0cps\u547d\u4ee4\u5c31\u662f\u6700\u57fa\u672c\u8fdb\u7a0b\u67e5\u770b\u547d\u4ee4\u3002\u4eca\u5929\u5c0f\u7f16\u5c31\u6765\u5e26\u9886\u5927\u5bb6\u4e00\u8d77\u5b66\u4e60Linux\u4e0b\u5206\u6790\u8fdb\u7a0b\u7684\u547d\u4ee4--PS\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n 1. ps\u662f\u4ec0\u4e48\uff1f<\/strong><\/div>\n \u8981\u5bf9\u8fdb\u7a0b\u8fdb\u884c\u76d1\u6d4b\u548c\u63a7\u5236\uff0c\u9996\u5148\u5fc5\u987b\u8981\u4e86\u89e3\u5f53\u524d\u8fdb\u7a0b\u7684\u60c5\u51b5,\u4e5f\u5c31\u662f\u9700\u8981\u67e5\u770b\u5f53\u524d\u8fdb\u7a0b\uff0cps\u547d\u4ee4\u5c31\u662f\u6700\u57fa\u672c\u8fdb\u7a0b\u67e5\u770b\u547d\u4ee4\u3002\u4f7f\u7528\u8be5\u547d\u4ee4\u53ef\u4ee5\u786e\u5b9a\u6709\u54ea\u4e9b\u8fdb\u7a0b\u6b63\u5728\u8fd0\u884c\u548c\u8fd0\u884c\u7684\u72b6\u6001\u3001\u8fdb\u7a0b\u662f\u5426\u7ed3\u675f\u3001\u8fdb\u7a0b\u6709\u6ca1\u6709\u50f5\u5c38\u3001\u54ea\u4e9b\u8fdb\u7a0b\u5360\u7528\u4e86\u8fc7\u591a\u7684\u8d44\u6e90\u7b49\u7b49.\u603b\u4e4b\u5927\u90e8\u5206\u4fe1\u606f\u90fd\u662f\u53ef\u4ee5\u901a\u8fc7\u6267\u884c\u8be5\u547d\u4ee4\u5f97\u5230\u3002<\/p>\n ps\u662f\u663e\u793a\u77ac\u95f4\u8fdb\u7a0b\u7684\u72b6\u6001\uff0c\u5e76\u4e0d\u52a8\u6001\u8fde\u7eed\uff1b\u5982\u679c\u60f3\u5bf9\u8fdb\u7a0b\u8fdb\u884c\u5b9e\u65f6\u76d1\u63a7\u5e94\u8be5\u7528top\u547d\u4ee4\u3002<\/p>\n \u57fa\u672c\u53c2\u6570\uff1a<\/strong><\/span><\/div>\n -A \uff1a\u6240\u6709\u7684\u8fdb\u7a0b\u5747\u663e\u793a\u51fa\u6765\uff0c\u4e0e -e \u5177\u6709\u540c\u6837\u7684\u6548\u7528\uff1b<\/p>\n -a \uff1a\u663e\u793a\u73b0\u884c\u7ec8\u7aef\u673a\u4e0b\u7684\u6240\u6709\u8fdb\u7a0b\uff0c\u5305\u62ec\u5176\u4ed6\u7528\u6237\u7684\u8fdb\u7a0b\uff1b<\/p>\n -u \uff1a\u4ee5\u7528\u6237\u4e3a\u4e3b\u7684\u8fdb\u7a0b\u72b6\u6001 \uff1b<\/p>\n x \uff1a\u901a\u5e38\u4e0e a \u8fd9\u4e2a\u53c2\u6570\u4e00\u8d77\u4f7f\u7528\uff0c\u53ef\u5217\u51fa\u8f83\u5b8c\u6574\u4fe1\u606f\u3002<\/p>\n \u8f93\u51fa\u683c\u5f0f\u89c4\u5212\uff1a<\/strong><\/span><\/div>\n l \uff1a\u8f83\u957f\u3001\u8f83\u8be6\u7ec6\u7684\u5c06\u8be5PID \u7684\u7684\u4fe1\u606f\u5217\u51fa\uff1b<\/p>\n j \uff1a\u5de5\u4f5c\u7684\u683c\u5f0f (jobs format)<\/p>\n -f \uff1a\u505a\u4e00\u4e2a\u66f4\u4e3a\u5b8c\u6574\u7684\u8f93\u51fa\u3002<\/p>\n \u4e0b\u9762\u6211\u4eec\u5c31\u6765\u4e00\u4e2a\u547d\u4ee4\u8fdb\u884c\u5b9e\u8df5\uff0c\u770b\u770b\u4e0d\u540c\u7684\u53c2\u6570\u90fd\u6709\u4e9b\u4ec0\u4e48\u6548\u679c\u3002<\/p>\n 2. \u4e0d\u52a0\u53c2\u6570\u6267\u884cps\u547d\u4ee4\u4f1a\u8f93\u51fa\u4ec0\u4e48\uff1f<\/strong><\/div>\n \u8fd9\u662f\u4e00\u4e2a\u57fa\u672c\u7684 ps \u4f7f\u7528\uff0c\u6211\u4eec\u6765\u770b\u770b\u63a7\u5236\u53f0\u4e2d\u6267\u884c\u8fd9\u4e2a\u547d\u4ee4\u5e76\u67e5\u770b\u7ed3\u679c\u3002 \u7ed3\u679c\u9ed8\u8ba4\u4f1a\u663e\u793a4\u5217\u4fe1\u606f\uff1a<\/p>\n
\u8fd9\u4e9b\u4fe1\u606f\u5728\u663e\u793a\u65f6\u672a\u6392\u5e8f\u3002<\/p>\n 3. \u5982\u4f55\u663e\u793a\u6240\u6709\u5f53\u524d\u8fdb\u7a0b\uff1f<\/strong><\/div>\n \u4f7f\u7528 -a \u53c2\u6570\uff0c-a \u4ee3\u8868 all\u3002\u540c\u65f6\u52a0\u4e0ax\u53c2\u6570\u4f1a\u663e\u793a\u6ca1\u6709\u63a7\u5236\u7ec8\u7aef\u7684\u8fdb\u7a0b\u3002<\/p>\n $ ps -ax \r\n# \u8fd9\u4e2a\u547d\u4ee4\u7684\u7ed3\u679c\u6216\u8bb8\u4f1a\u5f88\u957f\u3002\u4e3a\u4e86\u4fbf\u4e8e\u67e5\u770b\uff0c\u53ef\u4ee5\u7ed3\u5408less\u547d\u4ee4\u548c\u7ba1\u9053\u6765\u4f7f\u7528\u3002 \r\n$ ps -ax | less \r\n<\/pre>\n |